WORD OLE ½d¨Ò1: ------------------------------------------------------------ unit oleword; // Need a form with a button, memo, and edit component. // Written for MSWord 8. // Also need to create a test document d:\test.doc interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, OLEAuto, ShellAPI, StdCtrls; type TForm1 = class(TForm) Memo1: TMemo; Edit1: TEdit; Button1: TButton; procedure Button1Click(Sender: TObject); private public MSWord: Variant; // WordVersion: Byte; end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); var Test, Test1: Integer; AString: Variant; begin MSWord := CreateOLEObject('Word.Application'); //Word 8 MSWord.Documents.Open(FileName:='d:\test.doc', ReadOnly:=True); MSWord.Visible := 1; //Uncomment if you wish to show the file; Test := MSWord.FontNames.Count; For Test1 := 1 To Test do begin AString := MSWord.FontNames.Item(Test1) ; Memo1.Lines.Add(AString); end; MSWord.ActiveDocument.Range(Start:=0, End:=0); MSWord.ActiveDocument.Range.InsertAfter(Text:='Title'); MSWord.ActiveDocument.Range.InsertParagraphAfter; MSWord.ActiveDocument.Range.Font.Name := 'Arial'; MSWord.ActiveDocument.Range.Font.Size := 24; AString := MSWord.ActiveDocument.Range.Font.Name; Edit1.Text := AString; end; end.