von sarotti » Mi, 07.10.2009 21:02
Hallo zusammen,
habe beim weiteren Stöbern noch mal bei Andrew Pitonyak vorbeigeschaut... SUPER QUELLE!!!!
Hier die auf seinen Hinweisen basierende (modifizierte) Lösung:
Code: Alles auswählen
sub Spellcheck
Dim s() As Variant
Dim vReturn As Variant, i As Integer
Dim emptyArgs(0) as new com.sun.star.beans.PropertyValue
Dim aLocale As New com.sun.star.lang.Locale
aLocale.Language = "en"
aLocale.Country = "GB"
s = Array("xray", "anesthesiologist","Pitonyak", "misspell")
'http://api.openoffice.org/common/ref/com/sun/star/linguistic2/XSpellChecker.html
Dim vSpeller As Variant
vSpeller = createUnoService("com.sun.star.linguistic2.SpellChecker")
For i = LBound(s()) To UBound(s())
vReturn = vSpeller.isValid(s(i), aLocale, emptyArgs())
if vReturn = False then
vReturnS= vSpeller.spell(s(i), aLocale, emptyArgs())
sAlternativen=vReturnS.Alternatives
for a=0 To UBound(sAlternativen)
sAlternative=sAlternative+vReturnS.Alternatives(a)+chr(13)
next
end if
MsgBox "Rechtschreibprüfung des Wortes '" & s(i) & "' ergibt: " & vReturn &chr(13)&chr(13)& sAlternative
sAlternative=""
Next
end sub
Vielleicht hilft es ja dem einen oder anderen
Gruß
sarotti
Hallo zusammen,
habe beim weiteren Stöbern noch mal bei Andrew Pitonyak vorbeigeschaut... SUPER QUELLE!!!!
Hier die auf seinen Hinweisen basierende (modifizierte) Lösung:
[code]
sub Spellcheck
Dim s() As Variant
Dim vReturn As Variant, i As Integer
Dim emptyArgs(0) as new com.sun.star.beans.PropertyValue
Dim aLocale As New com.sun.star.lang.Locale
aLocale.Language = "en"
aLocale.Country = "GB"
s = Array("xray", "anesthesiologist","Pitonyak", "misspell")
'http://api.openoffice.org/common/ref/com/sun/star/linguistic2/XSpellChecker.html
Dim vSpeller As Variant
vSpeller = createUnoService("com.sun.star.linguistic2.SpellChecker")
For i = LBound(s()) To UBound(s())
vReturn = vSpeller.isValid(s(i), aLocale, emptyArgs())
if vReturn = False then
vReturnS= vSpeller.spell(s(i), aLocale, emptyArgs())
sAlternativen=vReturnS.Alternatives
for a=0 To UBound(sAlternativen)
sAlternative=sAlternative+vReturnS.Alternatives(a)+chr(13)
next
end if
MsgBox "Rechtschreibprüfung des Wortes '" & s(i) & "' ergibt: " & vReturn &chr(13)&chr(13)& sAlternative
sAlternative=""
Next
end sub[/code]
Vielleicht hilft es ja dem einen oder anderen
Gruß
sarotti