[英]Get particular page from Word document using Open XML SDK
I want to convert each page of document into separate word document. 我想将文档的每一页转换成单独的Word文档。 So i need to get every page of document. 所以我需要获取文档的每一页。 I am not able to differentiate pages in open xml format. 我无法区分开放xml格式的页面。 So please move me to right direction. 因此,请向正确的方向移动。
using (WordprocessingDocument document = WordprocessingDocument.Open("test.docx", true))
{
MainDocumentPart mainPart = document.MainDocumentPart;
}
Based on the documentation here , The client uses LastRenderedPageBreak
toidentify pages when its last saved. 根据此处的文档,客户端将使用LastRenderedPageBreak
上次保存页面的时间。 and the xml for it is: 和它的XML是:
<w:lastRenderedPageBreak/>
I think you can use this to check and break pages unless the document you are working with is auto generated and haven't got any lastRenderedPageBreak
s. 我认为您可以使用它来检查和中断页面,除非您正在使用的文档是自动生成的并且没有任何lastRenderedPageBreak
。
Also this approach will only work for documents with single column layouts. 同样,该方法仅适用于具有单列布局的文档。 But with documents with multi column layouts looks like there are issues. 但是对于具有多列布局的文档来说似乎存在问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.