Board index » delphi » Using MS Word spelling checker

Using MS Word spelling checker

Hello,

I have the following question. Is it possible to use from within my own app
the MS Word spellingchecker?
I guess this has to do with OLE objects. In the helpfile there is an example
of how to print using MS Word. Is this also possible for the
spellingchecker?

Many thanks, Darius Blaszijk

 

Re:Using MS Word spelling checker


The following code should give you a start on how to use Word as a spell
checker. It is based on this Microsoft support document
http://support.microsoft.com/support/kb/articles/Q243/8/44.ASP

procedure TfrmMain.FormCreate(Sender: TObject);
begin
  mmoText.Text := 'This is some mispelled textt. ' +
    'We''ll send it to Word and recieve the resultes.';
end;

procedure TfrmMain.btnSpellCheckClick(Sender: TObject);
var
  oWord,
  oDoc: OleVariant;
begin
  // start Word
  oWord := CreateOleObject('Word.Application');
  // add a new document
  oDoc := oWord.Documents.Add;

  // put the text in the document
  oDoc.Content.Text := mmoText.Text;
  oDoc.Activate;
  // start spell checking
  oDoc.CheckSpelling;

  // when spell checking is done, refresh the text
  mmoText.Text := oDoc.Content.Text;

  // close the document
  oDoc.Saved := True;
  oDoc.Close;

  // quit Word
  oWord.Quit;
end;

Quote
"Darius Blaszijk" <DBlasz...@ZonNet.nl> wrote in message

news:q%dW5.1657$MU5.11549@zonnet-reader-1...
Quote
> Hello,

> I have the following question. Is it possible to use from within my own
app
> the MS Word spellingchecker?
> I guess this has to do with OLE objects. In the helpfile there is an
example
> of how to print using MS Word. Is this also possible for the
> spellingchecker?

> Many thanks, Darius Blaszijk

Other Threads