ExtendedFilePropertiesPart.Properties.Pages.Text returns incorrect value.
-
Thursday, May 03, 2012 4:41 AM
Hi
I am trying to get the page count of a .docx file. There are 70 pages in the file. I have written below code for this.
WordprocessingDocument ccDocument = WordprocessingDocument.Open("C:\\MC_11943.docx", false); int ccDocPageCount = Convert.ToInt32(ccDocument.ExtendedFilePropertiesPart.Properties.Pages.Text);The above code always return 3 as the page count.
- Is there any way to make "ExtendedFilePropertiesPart.Properties.Pages.Text" return correct value?
- Is there an alternate way to get page count (using Open xml sdk or anything other than interop dll)?
All Replies
-
Friday, May 04, 2012 2:53 AMModerator
Hi Chaitanya,
Tnanks for posting in the MSDN Forum.
What's your shown to me works fine on my side. I would recommend you use Word PIA to access document pages number to check whether the ExctendedFilePropertiestPart.Properties has been changed via unknow reason.
The following reference will help you access the pages number via Word PIA:
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.selection.information.aspx
And this thread will show a sample: http://social.msdn.microsoft.com/Forums/eu/vsto/thread/aa54bb47-5093-4b87-90ff-3622ab527827
I hope it can help you.
Have a good day,
Tom
Tom Xu [MSFT]
MSDN Community Support | Feedback to us
- Marked As Answer by Tom_Xu_WXModerator Wednesday, May 30, 2012 7:37 AM

