We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get Total Number of Pages (Page Count) in Word Document - Aspose.Words for .NET

We receive the following error message when we load the attached Word document and get its page count.


Aspose.Words.Document wordDoc = new Aspose.Words.Document(FILEPATH);
int maxpages = wordDoc.PageCount;


[NullReferenceException: Object reference not set to an instance of an object.]
x996431aaaaf00543.xf4c807956df6c3b9.x6bf3c6b45600dc1e(x687bd29facb7e34a x7cc44cab9e9f8397) +110
x996431aaaaf00543.xf4c807956df6c3b9.x70f2a9357c1d25dc(x687bd29facb7e34a x7cc44cab9e9f8397) +127
x996431aaaaf00543.xf4c807956df6c3b9.Render(x2094302a66c2ec77 nodeRenderParams) +174
x996431aaaaf00543.x3064c6a807d3a0a8.x5b81632e5b71b64c(XmlDocument x5510939d5b9dcd91, SizeF xbc26217ba3290abe, x56ef2519e07fdbb4 x10154c16e21df88a) +307
x3d94286fe72124a8.x73d966e39902908a.xe406325e56f74b46(DrawingML x91ebfdc604552811) +252
x59d6a4fc5007b7a4.xa7492065dee59ad0.x539f48f6ee6ea753(xdeb77ea37ad74c56 x1e972e751678e682, Boolean& xf31bd0ec37d2cc8b) +236
x4adf554d20d941a6.x544de0c6d24f79dc.x2b797a3c54087a9b() +143
x4adf554d20d941a6.x544de0c6d24f79dc.get_xdc1bf80853046136() +15
x4adf554d20d941a6.xa67197c42bddc7dc.get_x887b872a95caaab5() +74
x4adf554d20d941a6.x56410a8dd70087c5.get_xdc1bf80853046136() +20
x4adf554d20d941a6.x6d3ade29d016f4ea.x5f6867bc5a977cb1() +460
x4adf554d20d941a6.x09e62a55cab70965.x5de571cf1cd1652c(xf6937c72cebe4ad1 x311e7a92306d7199) +388
x4adf554d20d941a6.x09e62a55cab70965.xc3819e13f60dd8e6(xf6937c72cebe4ad1 x311e7a92306d7199, Int32 xcd3a9f82634fe5f9) +116
x4adf554d20d941a6.x71da84fff8849445.xc3819e13f60dd8e6(x53cb1139c5c64ee6 xd7e5673853e47af4, Int32 xcd3a9f82634fe5f9, Boolean x3175070523842c98) +151
x4adf554d20d941a6.x4ddd0723770f9758.xb47a6df2eae4ba51() +113
x4adf554d20d941a6.x4ddd0723770f9758.xc3819e13f60dd8e6(x3d1ad8ce75f0db3a xd3311d815ca25f02, Int32 xd284dd7d525c5491, Boolean x3175070523842c98, Boolean x4097fa47409be495) +98
x4adf554d20d941a6.xea876d525d28ff96.xf0d7cc2854ee439f(x46bd7081dec08b8e xf8d6d5bf13f5917f) +74
x4adf554d20d941a6.xac6c82c74ce247fb.xc3819e13f60dd8e6(Boolean xfad304b5f8f3bb5b) +285
x4adf554d20d941a6.xb1f375aa1b12d10f.x9b961d025fb6a1b3(xc7f90d9c7c51cede xbbe2f7d7c86e0379, Boolean x6b0ad9f73c48ad53) +189
x4adf554d20d941a6.x4af2add38e634ad4.xc3819e13f60dd8e6(xc7f90d9c7c51cede xbbe2f7d7c86e0379) +114
x4adf554d20d941a6.xac6c82c74ce247fb.xc3819e13f60dd8e6(Boolean xfad304b5f8f3bb5b) +285
x4adf554d20d941a6.xa268fdb9ca040dde.xc3819e13f60dd8e6(Boolean xfad304b5f8f3bb5b) +89
x59d6a4fc5007b7a4.xcde671c53995c411.xd9db07500873ae98(Document x3664041d21d73fdc, xdeb77ea37ad74c56 xdfde339da46db651) +499
Aspose.Words.Document.x410db0f4a89a6ef1(Boolean x24af0daafcd8fb8c) +69
Aspose.Words.Document.get_PageCount() +10

Hi Tim,

Thank you for inquiry. While using latest Aspose.Words 11.0.0.
I managed to reproduce this problem on my side. I have
logged your issue into our bug tracking system. Your request has also been
linked to the appropriate issue. Once we sort it out, we will let you
know. Sorry for inconvenience.

I just ran into this issue with one of my templates also. I can send you the template if you’d like to see it.

Hi Adam,

Thank you for inquiry. First off, please try to use the latest version at your end and see if it resolves your issue. However, if it still doesn’t resolve your issue then please share template document here for further investigation.

I tried upgrading to the latest version and still get the exception. I have attached the docx.

Hi Adam,

Thank you for inquiry. While using latest Aspose.Words 11.0.0. I managed to reproduce this problem on my side. I have attached Word document to similar issue into our bug tracking system. Once we sort it out, we will let you know. Sorry for inconvenience.

Issue id: WORDSNET-5945

The issues you have found earlier (filed as WORDSNET-5945) have been fixed in this Aspose.Words for .NET update and this Aspose.Words for Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.