Get a specific page from a Word document using the Open XML SDK

I want to convert each page of a document into a separate document. Therefore, I need to get every page of the document. I cannot distinguish between pages in open xml format. So please move me in the right direction.

using (WordprocessingDocument document = WordprocessingDocument.Open("test.docx", true)) { MainDocumentPart mainPart = document.MainDocumentPart; } 
0
source share
1 answer

According to the documentation here , the client uses LastRenderedPageBreak identify pages the last time they were saved. and xml for it:

 <w:lastRenderedPageBreak/> 

I think you can use this to check and paginate pages, if only the document you are working with is automatically generated and has no LastRenderedPageBreak s.

Also, this approach will only work for documents with single-column layouts. But with docs with multi-column layouts looks like a problem.

+1
source

Source: https://habr.com/ru/post/1258073/


All Articles