`
lanfei
  • 浏览: 150481 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

delphi 利用Work 实现套打

 
阅读更多
原文地址:http://xxzqb.blog.163.com/blog/static/4122142920089249514506/

定义组件
    ChooseWA: TWordApplication;
    ChooseWD: TWordDocument;
    ChooseWF: TWordFont;

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;






分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics