Use ASP and Word to check the server-side spell check

zhaozj2021-02-08  240

Compiling Ganfei (2000-09-26) The issues discussed herein are related to the following: Microsoft Word 97 for Windows Microsoft Visual InterDev, Version 6.0 Microsoft Internet Information Server Version 4.0 Overview This article describes how to add Microsoft Word to the web page ASP file Spell check function. Detailed steps Follow these steps to establish an ASP application: 1. On the machine on the machine, start Microsoft Visual InterDev 6.0, select File / New Project. 2. In the name editing domain of the New Engineering dialog, enter "WebSPell" and double-click the new web engineering icon. 3. In the WEB Engineering Wizard dialog, enter or select your web server name. Click Next again, click Next. 4. After the Visual InterDev creation project is completed, open the project menu, select "Add Web Item / HTML Page", named "Checkspelling", then click Open. 5. The added HTML page is opened by the design view by default. Drag an HTML text area on the page, place an HTML submission button, lay out according to your hobbies, enter some text on the page, tell the user to enter the text that you need to spell check in the text domain. 6, select all objects (Ctrl a) on the page, then select Form from the HTML menu of Visual Interdev, wrap the objects in the form. 7. Click the source function page at the bottom of the current window to switch to the source display view. Modify HTML Open

tag of the action attribute value is Results.asp. 8. Open the Project menu, select "Add Web Item / Active Server Page", named "Results", then click "Open".

9. For new pages, switch to the source view, enter the following code between the tag:

Spelling Results
<% = request ("textarea1" )%>

<% 'don't allow Other 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 the web user entered. dim txt txt = Request ( "TEXTAREA1") wdApp.Selection.TypeText CStr (txt) 'Check Spelling With PROMPTING.' WDDOC.CHECKSPELING,, 0 'Get Spelling Errors Collection. Dim WderRors Set WderRors = WDDoc.spellingerRRORS%> <%' Handle No-Error Condition. IF WDE RRRORS.COUNT = 0 THEN%> There WERE no SPELLING Errors. <% otWise Build A Table of Suggestions. Else%> there <% = wderrors.count%> Spelling Error (s).

Word

suggestions <% for Each WordRROR IN WordRRORS 'WRITE THE WORD IN WORSTION. Response.write ("< Tr> ") Response.write (" ") '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) -2) 'Write out suggestions. Response.write (strsuggestions) Else Response.write ("none.") endiff set wdsuggestions = Nothing response.write (" ") Next Endiff 'Release References. Set WDERRORS = Nothing Set WDDOC = Nothing Set WDAPP = Nothing 'We're Done, Allow Other Sessions To Continue. Application ("Wordinuse") = 0%> 10, in the Visual InterDev Engineering Browse window, double-click the global.asa file, add the following 2 segments between the