🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: mailing.comp.open-office
1 messages
1 total messages Started by catialin Tue, 29 Jun 2004 12:59
Use openOffice spellChecker without Texte Application
#1
Author: catialin
Date: Tue, 29 Jun 2004 12:59
52 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads