怎么实现TextBox拼写检查?

winderxp 2005-09-27 10:51:07
我在ASP.NET页面中有个TextBox,还有一个Spell Check的按钮
点击Spell Check按钮,检查TextBox中的拼写问题?
用C#和javascript实现都可以,哪位达人能提供方法?有源代码更好
需要在Web页面上实现
Thanks
...全文
159 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
winderxp 2005-10-08
  • 打赏
  • 举报
回复
有没有客户端拼写检查的方法?
winderxp 2005-10-08
  • 打赏
  • 举报
回复
vivianfdlpw()
这是什么原因?
mba9001 2005-10-08
  • 打赏
  • 举报
回复
up
winderxp 2005-10-08
  • 打赏
  • 举报
回复
拒绝访问。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.UnauthorizedAccessException: 拒绝访问。

ASP.NET 未被授权访问所请求的资源。请考虑授予 ASP.NET 请求标识访问此资源的权限。ASP.NET 有一个在应用程序没有模拟时使用的基进程标识(通常,在 IIS 5 上为 {MACHINE}\ASPNET,在 IIS 6 上为网络服务)。如果应用程序正在通过 <identity impersonate="true"/> 模拟,则标识将为匿名用户(通常为 IUSR_MACHINENAME)或经过身份验证的请求用户。

若要授予 ASP.NET 对文件的写访问权,请在资源管理器中右击该文件,选择“属性”,然后选择“安全”选项卡。单击“添加”添加适当的用户或组。突出显示 ASP.NET 帐户,选中所需访问权限对应的框。

源错误:


行 300: {
行 301: int iErrorCount=0;
行 302: Word.Application app = new Word.Application();
行 303: if(tBox.Text.Length>0)
行 304: {

vivianfdlpw 2005-09-27
  • 打赏
  • 举报
回复
引用MicrosoftWord ObjectLibrary (Interop.Word.dll)

using Word;
using System.Reflection;


private void button1_Click(object sender,System.EventArgs e)
{
fSpellCheck(textBox1,label1);
}

public void fSpellCheck(TextBox tBox,Label lLbl)
{
int iErrorCount=0;
Word.Application app=new Word.Application();
if(tBox.Text.Length>0)
{
app.Visible=false;
object template=Missing.Value;
object newTemplate=Missing.Value;
object documentType=Missing.Value;
object visible=true;
object optional=Missing.Value;
_Documentdoc=app.Documents.Add(ref template,
ref newTemplate,ref documentType,ref visible);
doc.Words.First.InsertBefore(tBox.Text);
Word.ProofreadingErrors we=doc.SpellingErrors;
iErrorCount=we.Count;
doc.CheckSpelling(ref optional,ref optional,ref optional,
ref optional,ref optional,ref optional,ref optional,
ref optional,ref optional,ref optional,
ref optional,ref optional);
if(iErrorCount==0)
lLbl.Text="SpellingOK.Noerrorscorrected";
else if(iErrorCount==1)
lLbl.Text="SpellingOK.1errorcorrected";
else
lLbl.Text="SpellingOK."+iErrorCount+
"errorscorrected";
object first=0;
object last=doc.Characters.Count-1;
tBox.Text=doc.Range(ref first,ref last).Text;
}
else
lLbl.Text="Textboxisempty";
object saveChanges=false;
object originalFormat=Missing.Value;
object routeDocument=Missing.Value;
app.Quit(ref saveChanges,ref originalFormat,ref routeDocument);
}
zhaoliang_chen 2005-09-27
  • 打赏
  • 举报
回复
使用RegularExpressionValidator
使用正则表达式
zhengtianling 2005-09-27
  • 打赏
  • 举报
回复
什么拼写检查

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧