Delphi-word插件-记录剪贴板样式表将要复制多种样式,是否改用正文样式问题修改

本文介绍如何通过Delphi利用Word COM接口读取每一页内容,并在另一Word文档中插入,涉及样式表和正文样式的问题。
摘要由CSDN通过智能技术生成

对word操作,采用word COM 方式:
读取word 每一页内容,然后插入到另一个word 并保存下来

procedure TForm1.btn1Click(Sender: TObject);
const
  wdFormatOriginalFormatting = $00000010;
    wdFormatSurroundingFormattingWithEmphasis = $00000014;
var
  wordApp, aDoc,aDoc2,oSection,myStartRange,myEndRange,aDoc3: OleVariant;
  i,j,pages,start,iend:Integer;
  stemp:string;
begin
  try
    wordApp := CreateOleObject('Word.Application');
    aDoc := wordApp.Documents.Add();
    aDoc2 :=  wordApp.Documents.open('C:\Users\Administrator\Desktop\word转换待研究问题\第四章 合同条款及格式.doc');
    //aDoc.Activate;

    aDoc.Activate;
    pages := aDoc2.ComputeStatistics(2, False);
//    ShowMessage(IntToStr(pages));

//    ShowMessage(IntToStr(aDoc.Sections.count));
//    myEndRange := aDoc.Range();
    wordApp.Selection.InsertFile('C:\Users\Administrator\Desktop\word转换待研究问题\123.doc','',true,False,False);
    for I := 0 to pages - 1 do
    beg
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值