delphiはWorkを利用してセットプレーを実現します。
1050 ワード
原文の住所:http://xxzqb.blog.163.com/blog/static/4122142920089249514506/
コンポーネントを定義
ChooseWA:TWorldApplication;
ChooseWD:TWord Dcument;
ChooseWF:TWord Font;
コンポーネントを定義
ChooseWA:TWorldApplication;
ChooseWD:TWord Dcument;
ChooseWF:TWord Font;
procedure TForm1.btn3Click(Sender: TObject);
var
ItemIndex: OleVariant;
filePath :OleVariant;
i,total:integer;
begin
ItemIndex := 1;
filePath :='c://temp//test.dot'; //
ChooseWA.Documents.Add(filePath,EmptyParam,EmptyParam,EmptyParam);
ChooseWD.ConnectTo(ChooseWA.Documents.Item(ItemIndex));
//ChooseWD.Range.InsertAfter(' '+#13);//#13 //
total:=ChooseWD.Comments.Count; //
for i:=1 to total do //
begin
ChooseWD.Comments.Item(i).Scope.Text :=mmo1.Text; // 1
end;
//
while total<>0 do
begin
ChooseWD.comments.Item(total).Delete;
total:=ChooseWD.Comments.Count;
end;
ChooseWA.Visible :=true; //
end;