Article View: mailing.comp.open-office
Article #1Use openOffice spellChecker without Texte Application
From: catialin
Date: Tue, 29 Jun 2004 12:59
Date: Tue, 29 Jun 2004 12:59
52 lines
2762 bytes
2762 bytes
Hi,
I try to use the openoffice spellchecker without creating texte
application. I meet one problem which is :
if I execute my delphi application after having one time execute
Texte application, my application finds misspelled word but if I have
never executed the spellchecker of the text application, my
application does not manage to find misspelled word. So I think that
there are initializations done in Texte application that I should do.
Does anybody manage to use the openoffice spellchecker without
creating or better without installing Texte application?
My code :
if VarisEmpty(ServiceManager) then
try ServiceManager :=
CreateOleObject('com.sun.star.ServiceManager');
except Raise Exception.Create('Couldn''t get ServiceManager');
end;
CoreReflection :=
ServiceManager.createInstance('com.sun.star.reflection.CoreReflection');
CoreReflection.forName('com.sun.star.lang.Locale').CreateObject(Locale);
Locale.Country := 'US';
Locale.Language := 'en';
Locale.Variant := 'WIN';
LinguServiceManager :=
ServiceManager.createInstance('com.sun.star.linguistic2.LinguServiceManager');
LinguProperties :=
ServiceManager.CreateInstance('com.sun.star.linguistic2.LinguProperties');
mySpell := LinguServiceManager.getSpellChecker ;
Properties := VarArrayCreate([0, -1], varVariant);
if mySpell.isValid(text,Locale,Properties) then
ShowMessage('OK')
else
begin
SpellAlternatives := mySpell.spell(text, Locale, Properties);
SizeAlternative := SpellAlternatives.getAlternativesCount;
Alternative := SpellAlternatives.getAlternatives;
Text := ' ';
for i := 0 to SizeAlternative-1 do
Text := Text + Alternative[i]+ ' ';
ShowMessage(Text);
SpellAlternatives := Unassigned;
end;
...
Thanks,
best regards
Technical Details
Message-ID:
<9adab477.0406290459.4215ec84@posting.google.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews2.google.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: fe758,bdf1f7217c1b4807,start X-Google-Thread: fd196,1ef198fa5f643e38,start X-Google-Attributes: gidfe758,gidfd196,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews2.google.com!not-for-mail From: catialin@yahoo.fr (catialin) Newsgroups: mailing.comp.open-office,borland.public.delphi.oleautomation Subject: Use openOffice spellChecker without Texte Application Date: 29 Jun 2004 05:59:27 -0700 Organization: http://groups.google.com Lines: 52 Message-ID: <9adab477.0406290459.4215ec84@posting.google.com> NNTP-Posting-Host: 80.14.5.205 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1088513968 9326 127.0.0.1 (29 Jun 2004 12:59:28 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 29 Jun 2004 12:59:28 +0000 (UTC)