Shashi
Shashi

Reputation: 2898

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

Upvotes: 0

Views: 3887

Answers (1)

Flowerking
Flowerking

Reputation: 2581

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.

Upvotes: 1

Related Questions