April 17, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Modifying Spell Check for SharePoint Server 2007, Page 3

  • September 5, 2008
  • By Gustavo Velez
  • Send Email »
  • More Articles »

Spell Check Default Components

It is not necessary to use WebService spell check directly, as indicated in the last section; it is also possible to use the existing SharePoint default infrastructure for this purpose. The default implementation of spell check for MOSS is based in one ASPX page and two JavaScript files:

  • SpellChecker.aspx: (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\SpellChecker.aspx) contains the Web page used to show words with errors and the suggestions (shown in Figure 1)
  • SpellChecker.js: (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\3082\SpellChecker.js) contains the routines to call the WebService, show and rectify words with errors
  • SpellCheckerEntirePage.js: (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\3082\SpellChecker.js) works as a link between the aspx page and the routines of the JavaScript in SpellChecker.js.

In the event the Language cannot be detected, the ASPX page initially shows a menu to select it from the available Languages List.

The default MOSS corrector page can be initiated from each ASPX page as well. To view the process, create a new file with the .aspx extension ("spellcheck.aspx", for example) in the directory "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\". Open the file with any ASCII text editor (Notepad) and add a reference to the SharePoint assembly:

<%@ Register Tagprefix="SharePoint"
Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>

Then, create references to the files with the JavaScripts:

<SharePoint:ScriptLink language="javascript"
                       name="core.js" runat="server" />
<SharePoint:ScriptLink language="javascript"
                       name="SpellCheckEntirePage.js"
                       runat="server" />

And a JavaScript section to call Spell Check:

<script language="javascript" type="text/javascript">
   function CheckSpell()
   {
      SpellCheckEntirePage('/_vti_bin/SpellCheck.asmx',
                           '/_layouts/SpellChecker.aspx');
   }
</script>

Finally, create the content controls where the user can write a text to be checked. In the example, it is one text box, but as many as are required can be created and spell check will loop through all of them scanning for errors. Use the syntax:

Some text to check &nbsp;&nbsp;
<input type="text" name="SomeText">
<br><br>

The button at the end will call the JavaScript and spell check:

<a href="javascript:" onclick="CheckSpell();">Spell Checker</a>

Call the aspx from MOSS using the URL (http[s]://ServerName/_layouts/ spellcheck.asp). After clicking the button, a popup window will appear, showing the incorrect words and the correction suggestions:

Figure 2: ASPX custom page using default spell check





Page 3 of 4



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel