Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExtendedFilePropertiesPart.Properties.Pages.Text returns incorrect value #22

Closed
jeryini opened this issue Dec 12, 2014 · 1 comment
Closed

Comments

@jeryini
Copy link

jeryini commented Dec 12, 2014

I am using the following code to open WordprocessingDocument from MemoryStream and then get the page size of the document, but it always returns the value 1, which is incorrect as the document contains 11 pages.

using (WordprocessingDocument myDoc = WordprocessingDocument.Open(reportDocumentStream, false))
{
    pages = int.Parse(myDoc.ExtendedFilePropertiesPart.Properties.Pages.Text);
}
@EricWhiteDev
Copy link
Contributor

That value is not guaranteed to be correct. In fact, it often will be incorrect. This is one of the issues with Open XML - determining pagination is a big job. (This is true for other document formats, including ODF, not just XML.) Currently, Microsoft's advice is that if you need exact pagination information, you should automate Word.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants