Ooxml Document Page Count Issue



I’m having an issue pulling an accurate page count from an OoxmlCompliance.Iso29500_2008_Transitional Document. It says that there are only 3 pages, when in fact there are 4.

Here’s the code I ran, directly to get this output through Visual Studio’s intermediate window:

Expression has been evaluated and has no value

Expression has been evaluated and has no value

Expression has been evaluated and has no value



    ContentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"

I also verified that re-importing the document still yields a page count of three.

And attached is my document. As you can clearly see in the document, there is one table row and the repeated header on the last page. In my hopes to work around this, I also tried saving a pdf version, but that showed up as 3 pages and does not match the document. Both are in the zipped file.

Files.zip (69.3 KB)

I also just upgraded to .Net 17.8 to try and get better results without luck!

This is also a cascading issue, this is part of a bunch of documents that are appended together, and the inaccurate page counts are reflected in the Table of Contents field. The document after this show as being on page 17, despite actually being on page 18, which makes our compiled document seem unprofessionally inaccurate.

Please help!




Thanks for your inquiry. We have tested the scenario with your shared document and noticed the reported issue. We have logged a ticket WORDSNET-15755 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience.


I’m afraid that even after the switch back from the OoxmlCompliance.Iso29500_2008_Transitional document, we are still having issues with the page numbers not being correctly populated into the Table of Contents. In this particular example, you can see that the page numbers increasingly differ, and end with the last entry being reported as 8 pages after the document ends.

files.zip (2.7 MB)

Our documents are dynamically generated, so there is no input document, but you should be able to reproduce the issue with this code:

var doc = new Document("c:\\TEMP\\Output.docx");



Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15766. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.