如何使用c#.net在ms字上插入空白页? [英] How to insert a blank page on ms word using c#.net?

查看:85
本文介绍了如何使用c#.net在ms字上插入空白页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用c#.net在ms字上插入空白页?

How to insert a blank page on ms word using c#.net?

推荐答案

你好,



你可以使用OpenXML。

http://msdn.microsoft.com/en-us/library/office/bb448854(v = office.15).aspx [ ^ ]



这是一个例子:

Hello,

you can do it with OpenXML.
http://msdn.microsoft.com/en-us/library/office/bb448854(v=office.15).aspx[^]

Here is an example:
WordprocessingDocument myDoc =
WordprocessingDocument.Open(@"C:\temp\doc.docx", true);

Paragraph para = new Paragraph(new Run(new Break() { Type = BreakValues.Page }));
MainDocumentPart mainPart = myDoc.MainDocumentPart;

mainPart.Document.Body.InsertAfter(para, mainPart.Document.Body.LastChild);
mainPart.Document.Save();





Valery。



Valery.


这篇关于如何使用c#.net在ms字上插入空白页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆