Get particular page from Word document using Open XML SDK

瘦欲@ 提交于 2019-12-04 05:43:31

问题


I want to convert each page of document into separate word document. So i need to get every page of document. I am not able to differentiate pages in open xml format. So please move me to right direction.

 using (WordprocessingDocument document = WordprocessingDocument.Open("test.docx", true))
        {
            MainDocumentPart mainPart = document.MainDocumentPart;
}

回答1:


Based on the documentation here, The client uses LastRenderedPageBreak toidentify pages when its last saved. and the xml for it is:

<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 lastRenderedPageBreaks.

Also this approach will only work for documents with single column layouts. But with documents with multi column layouts looks like there are issues.



来源:https://stackoverflow.com/questions/14479698/get-particular-page-from-word-document-using-open-xml-sdk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!