简体   繁体   中英

Get particular page from Word document using Open XML SDK

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;
}

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 lastRenderedPageBreak s.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM