aspose.words复制插入同一word文档中的某个页面

选择word模板

  Document doc = new Document(Server.MapPath("~\\templet") + "\\" + name.Name);

  doc.MailMerge.CleanupOptions = doc.MailMerge.CleanupOptions & ~MailMergeCleanupOptions.RemoveUnusedRegions;

  DocumentBuilder builder = new DocumentBuilder(doc);

插入页面

一句代码就可以搞定。

Aspose.Words.Document src;

doc.AppendDocument(src, ImportFormatMode.KeepSourceFormatting);

src是从word文档中选择的某一页的实例。

目前只实现了顺序插入页面的方法,也就是在文档最后添加新的页面,无法在特定页面插入新页面。比如,有4页,在第二页后插入新的页面。

选择特定页

有点麻烦。没有提供单独的API,但从官网的DEMO中可以找到改功能。DEMO中的PageSplitter实现了该功能。

或者下载

你可能感兴趣的:(word)