Santry Technology Solutions, Content Management, DotNetNuke, SharePoint Consulting
Register | Login
Friday, July 03, 2009

Sections
  
About Us
  
Partners
Downloads
  
 WWWCoder.com Resource Directory

Web Service Wrapper for Word Spell Checking
9/20/2004 2:08:44 PM

Wrapper for calling MS Word for spell checking Web service.



Public Class SpellChecker
Inherits System.Web.Services.WebService


#Region " Web Services Designer Generated Code "


Public Sub New()
MyBase.New()

'This call is required by the Web Services Designer.
InitializeComponent()

'Add your own initialization code after the InitializeComponent() call

End Sub


'Required by the Web Services Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Web Services Designer
'It can be modified using the Web Services Designer.
'Do not modify it using the code editor.
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
'CODEGEN: This procedure is required by the Web Services Designer
'Do not modify it using the code editor.
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

#End Region



<WebMethod()> Public Function CheckSpelling(ByVal inString As String) As String
Dim bResult As Boolean
Dim strReturn As String
Dim filler As Object
Try
Dim objWord As New Word.Application()
Dim tmpDoc As Word.Document
Dim arySuggestions As Word.SpellingSuggestions
Dim Suggestion As Word.SpellingSuggestion
tmpDoc = objWord.Documents.Add 'creates a blank document for holding values
bResult = objWord.CheckSpelling(inString, filler, filler, _
filler, filler, filler, filler, filler, filler, filler, filler, filler, filler)
If Not bResult Then
arySuggestions = objWord.GetSpellingSuggestions(inString)
For Each Suggestion In arySuggestions
strReturn = strReturn & Suggestion.Name & ", "
Next
arySuggestions = Nothing
Suggestion = Nothing
End If
strReturn = "Spell check result: " & bResult & " Suggested words: " & strReturn
tmpDoc.Saved = True
objWord = Nothing
tmpDoc = Nothing
Catch ex As Exception
strReturn = ex.Message
End Try
Return strReturn
End Function



End Class


Page Options:
format for printing  Format for Printer
email article  Email Page
add to your favorites   Add to Favorites
How would you rate the quality of this content?
Poor - - Excellent
Comments?
Overall Rating:
Comments Left:
  

 Latest Articles
  

 Latest News
  

 

Spotlight
Syndication

 


 


Digg This
 


DotNetNuke Platinum Benefactor

  
 

 Terms Of Use | Privacy Statement
 Copyright 2008 - Santry Technology Solutions, Box 172, Girard, PA 16417, (814) 774-0970