word| server The issues discussed in this article are related to the following:
Microsoft Word for Windows
Microsoft Visual InterDev, version 6.0
Microsoft Internet Information Server version 4.0
Profile
This article describes how to use Microsoft Word to add a spelling checker to a Web page ASP file.
Detailed steps
Follow these steps to build an ASP application:
1, on the Web server's machine, start Microsoft Visual InterDev 6.0, select File/new Project.
2, in the "New Project" dialog box name editing field, enter "Webspell", and then double-click the new Web Project icon.
3. In the following Web Project Wizard dialog box, enter or select your Web server name. Default working mode to master, click Next, and then click
"Finish".
4, after the creation of Visual InterDev project completed, open the Project menu, select "Add Web item\html page", named "CheckSpelling",
then click Open.
5, the added HTML page is opened in Design view by default. Drag an HTML text area on the page and place an HTML submit button, depending on your hobby
Make a layout, enter some text on the page, and tell the user to enter the text field that you want to check for spelling.
6, select all objects on the page (Ctrl + a), and then select form from the Visual InterDev HTML menu to wrap the object in the form.
7, click the Current window at the bottom of the Source function page, switch to the source display view. Modify the HTML open < FORM > tag's Action property value to
Results.asp.
8. Open the Project menu, select "Add Web item\active Server Page", name "Results", and click "Open".
9. For new pages, switch to Source view, and enter the following code between <BODY> tags:
<!--Page header-->
<p><center><font size=+4 color=red>spelling results</font></center>
<!--show user the text they entered-->
<p>the text you entered was:<p>
<font color=blue><%=request ("TEXTAREA1")%></font><p>
<!--Begin server-side script to check spelling errors-->
<%
' Don ' t allow sessions to re-enter:)
Do While (Application ("wordinuse") = 1)
Loop
Application ("Wordinuse") = 1
' Get Word references created in Global.asa.
Dim wdapp
Set wdapp = Application ("WordApp")
Dim wddoc
Set wddoc = Application ("WordDoc")
' Clear current contents.
Dim Wdrange
Set Wdrange = WdApp.Selection.Range
Wdrange.wholestory
Wdrange.delete
Set wdrange = Nothing
' Add the text ' Web user entered.
Dim txt
txt = Request ("TEXTAREA1")
WdApp.Selection.TypeText CStr (TXT)
' Check spelling without prompting.
' Wddoc.checkspelling, 0.
' Get spelling Errors collection.
Dim wderrors
Set wderrors = Wddoc.spellingerrors
%>
<% ' Handle no-error condition.
If Wderrors.count = 0 Then
%>
There were no spelling errors.
<%
' Otherwise build a table of suggestions.
Else
%>
<!--build a table to show errors & suggestions-->
<font Color=red>there were <%=wdErrors.Count%> spelling error (s) .</font><p>
<table border=1 cellpadding=1 cellspacing=1 width=75%>
<TR>
<td><b><font size=+1>word</font></b></td>
<td><b><font size=+1>suggestions</font></b></td></tr>
<%
For each wderror in Wderrors
' Write the word in question.
Response.Write ("<TR><TD>")
Response.Write (Wderror.text)
Response.Write ("</TD><TD>")
' Get spelling suggestions for it.
Dim wdsuggestions
Set wdsuggestions = Wdapp.getspellingsuggestions (Wderror.text)
If Wdsuggestions.count <> 0 Then
' A comma-separated list of suggestions.
Dim strsuggestions
Strsuggestions = ","
For each wdsuggestion in Wdsuggestions
Strsuggestions = strsuggestions & Wdsuggestion.name & ","
Next
' Remove extra comma & space.
Strsuggestions = Right (Strsuggestions, Len (strsuggestions)-2)
' Write out suggestions.
Response.Write (Strsuggestions)
Else
Response.Write ("None.")
End If
Set wdsuggestions = Nothing
Response.Write ("</TD></TR>")