這是我自己用的模組,用來顯示儲存WORD檔案,不過要安裝WORD才能正確執行!//********************//procedure TForm3.Button1Click(Sender: TObject);var MSWord:Variant;i,j:Integer;beginSaveDialog1.Filter:="*.DOC|*.DOC";SaveDialog1.DefaultExt:="DOC";if SaveDialog1.Execute thenbeginMSWord:=CreateOLEObject("Word.Application");MSWord.Documents.Open(FileName:=SaveDialog1.FileName,ReadOnly:=False);MSWord.Visible:=False;MSWord.ActiveDocument.Range(Start:=0,End:=0);Table1.Open;j:=Table1.RecordCount;Table1.First;for i:=1 to j dobeginMSWord.ActiveDocument.Range.InsertAfter(Text:=Table1.FieldByName("CODE").AsString+Table1.FieldByName("COLOR").AsString+Chr(13));Table1.Next;end;MSWord.Documents.Close;end;end;
這是我自己用的模組,用來顯示儲存WORD檔案,不過要安裝WORD才能正確執行!//********************//procedure TForm3.Button1Click(Sender: TObject);var MSWord:Variant;i,j:Integer;beginSaveDialog1.Filter:="*.DOC|*.DOC";SaveDialog1.DefaultExt:="DOC";if SaveDialog1.Execute thenbeginMSWord:=CreateOLEObject("Word.Application");MSWord.Documents.Open(FileName:=SaveDialog1.FileName,ReadOnly:=False);MSWord.Visible:=False;MSWord.ActiveDocument.Range(Start:=0,End:=0);Table1.Open;j:=Table1.RecordCount;Table1.First;for i:=1 to j dobeginMSWord.ActiveDocument.Range.InsertAfter(Text:=Table1.FieldByName("CODE").AsString+Table1.FieldByName("COLOR").AsString+Chr(13));Table1.Next;end;MSWord.Documents.Close;end;end;