I need to know how MS WORD page , is there a way to create a correct MS WORD (Correct tag in XML like LastRenderedPageBreak ...) pagination creating a file with OPENXML without opening it with MS WORD?
1 Answers
Pages are not represented in the OpenXML specification until a word processor renders the document. Once rendered, any page annotations reflect content positioning as it was represented by the last word processor. (Meaning the <lastRenderedPageBreak/>
node should be viewed as potentially volatile.)
It is not impossible to calculate page positions on your own, but there is a substantial amount of work involved.
There are ways to work around this limitation, depending on why you need the page information. (E.g. form fields for page numbers, bookmark fields for TOCs, splitting/merging by section rather than page.)
For more information on verifying how this shakes out in the raw markup, see this answer.
If you are able to comment with some more information, we may be able to point you toward a possible workaround.

- 1
- 1

- 506
- 4
- 10
-
i only need to know when the page changes in a .docx file without processing it with MS word . The file could have lists images... Is there a way to do that? – Vincenzo Morelli May 11 '17 at 13:03
-
If you're dealing with block items like images, you could get a reasonable estimate for where page breaks occur by looping through images summing their heights. You would also need to account for any style-spacing that occurs before/after your images. If you have mixed content (e.g. paragraphs of text with images throughout), this becomes more complicated). – Austin Drenski May 11 '17 at 13:17
-
Unfortunately i have to process very complex documents (1000+ pages) also with paraprahs with images throughout :( – Vincenzo Morelli May 11 '17 at 13:25
-
What do you need the page positions for? – Austin Drenski May 11 '17 at 13:32
-
We are developing an html tool that includes almost all MS Word features and other customer's requirements, but since the white sheet in which the user will write is represented by a we need to know when the content of that sheet end and the new starts. The project owner wants only the MS WORD pagination – Vincenzo Morelli May 11 '17 at 13:40
-
Unfortunately, that will be a heavy lift coming from OpenXML markup. It sounds like you'll need to write components to "fill pages" by determining how much space a given run of text or image requires. – Austin Drenski May 11 '17 at 14:20
-
so does't exist any word processor without graphic interface that does this work? – Vincenzo Morelli May 11 '17 at 14:27