Free Support Forum - aspose.com

Page Number is not getting Updated

Hi,

Page Number is not getting updated while using document.UpdateFields()

Totally there are 20 pages, But it is showing the default 1 of 3 in First page

it showing page 1 of 3 in First page in MS Word, After scrolling down to some other pages, The first number is getting updated.

Thanks,

Saravana kumar.S

Hi Saravana,


Thanks for your inquiry. After an initial test with Aspose.Words 14.7.0, I was unable to reproduce this issue on my side. I would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link. I hope, this helps.
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

Best regards,

Hi Hafeez,

Please Find the Sample Project for Page Number Issue.

Create a Document using this sample project.

My Input will be in HTML format.

Thanks.

Hi Saravana,


Thanks for your inquiry. Can you please try running the following simple code with Aspose.Words 14.8.0 and see how t goes on your end? PFA sample out.doc.

Document doc = new Document(MyDir + @“Global(21).doc);

doc.UpdateFields();

doc.Save(MyDir + @“out.doc);


What version of Microsoft Word are you getting this problem with? Secondly, you have attached a very big project in your last post, could you please attach a simplified runnable console application instead?

Best regards,

Hi Hafeez,

Thanks for your response,

the attached project is my live scenario please go through the project because i am creating a document using Html data , so when creating the document we are doing some Functionality like Page Break, Page Orientation/Landscape…etc.


sorry, even i tried the given code still having the same Error.

Thanks

Hi Saravana,


Thanks for your inquiry.
Saravana:
sorry, even i tried the given code still having the same Error.
Could you please attach your output document (.doc file) i.e. generated using Aspose.Words 14.8.0 on your end here for testing? It could well be a bug in Microsoft Word application. What version of Microsoft Word are you getting this problem with? Do you get the same problem when saving to PDF for example? Also, please confirm if the code mentioned in my previous post causes the same problem.

Best regards,

Hi hafeez,

Thanks for your response, In PDF also we are facing this issue please find the attached for for more details.

Thanks,
Saravana kumar.S

Hi Saravana,


Thanks for your inquiry.

Your document has 41 pages as reported by MS Word 2013 and OpenOffice Writer 4.0.1 (see attached screenshots and output Word document) and when you save this document to DOC format after calling UpdateFields method using Aspose.Words 14.11.0, the page numbering at the footer says ‘page 1 of 41’, ‘page 2 of 41’ and so on upto ‘page 41 of 41’. Can you please try running the following simple code with Aspose.Words 14.11.0 and see how t goes on your end?

Document doc = new Document(MyDir + @“24112014+01+Organisation+Wide+BCP_0_1.doc”);

doc.UpdateFields();

doc.Save(MyDir + @“out-awnet-14.11.0.doc”);


What version of Microsoft Word are you getting this problem with?

Best regards,

Hi Awais,


Thanks for the support.

We have tried the given solution but the issue remains same.

We using MS Office 2007.

Thanks.

Hi Rajesh,


Thanks for your inquiry. Unfortunately, we’re unable to reproduce this issue on our end. We checked it with MS Word 2007 also. Please make sure that you’re not using Aspose.Words in evaluation mode (see limitations here). You must apply license to get correct output in this case.

Best regards,

Hi Awais,

We are using purchased download only and still the page numbers showing incorrectly in the first page. We have given sample project and documents also please take some care to reproduce this issue in your end. For sample project and document please refer previous posts .We have only hope on you to get the fix for this issue .

Hi Rajesh,


Thanks for your inquiry. Unfortunately, we were unable to reproduce this issue on our end therefore we request you to please elaborate your scenario further by mentioning complete steps which allow us to reproduce the exact same problem on our end. Thanks for your cooperation.

Best regards,

Page Number is not getting updated while using document.UpdateFields()

PFA file, We have 19 pages, but it is showing the default 1 of 3 or 1 of 1 in First page of document when we open the document.

After scrolling down to other pages, The first number is getting updated automatically.

Please let us know any fix is available for this issue

Hi Rajesh,


Thanks for your inquiry. MS Word 2013 reports that there are 19 pages in “test+1+Commercial+Business+BCP_0_1.doc” document. Aspose.Words 15.6.0 also reports 19 pages (see Document.PageCount property). Aspose.Words also correctly rights the page number value in NUMPAGE field. Please see the following code. So, this seems to be a glitch in MS Word’s behavior:

Document doc = new Document(MyDir + @“test+1+Commercial+Business+BCP_0_1.doc”);

doc.UpdateFields();

foreach (Field field in doc.Range.Fields)

if (field.Type.Equals(FieldType.FieldNumPages))

Console.WriteLine(field.Result);

doc.Save(MyDir + @“15.6.0.docx”);


I hope, this helps.

Best regards,

Hi Awais,


Thanks for your reply.

We have applied the below code in the project. But still we facing the same page number issue. have attached the documents and snaps for evidence.

Thanks

Rajesh
<o:p></o:p>


Hi Rajesh,


Thanks for your inquiry. I tested the scenario and have managed to reproduce the same problem on my side using MS Word 2007. The problem does not occur when using MS Word 2013. For the sake of any correction, I have logged this problem in our issue tracking system as WORDSNET-12212. Our product team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,
Hi Awais,

Thanks for your response. We were waiting for this fix at earliest, as our clients of waiting for so long.

We were now using MS Word 2007.

Thanks
Rajesh

Hi Rajesh,


Thanks for your inquiry. This issue is currently pending for analysis and is in the queue. We will inform you via this thread as soon as this issue is resolved. We apologize for any inconvenience.

Best regards,

Hi Rajesh,


Regarding WORDSNET-12212, our product team has completed the work on your issue and has come to a conclusion that this issue and the undesired behaviour you’re observing is actually not a bug in Aspose.Words. So, we have closed this issue as ‘Not a Bug’.

This is a MS Word issue instead. The *.doc and *.docx formats do not contain values of layout fields (like PAGE and NUMPAGES) located in header/footer for each page. Usually, MS Word updates it automatically when opened document, but it does not in this case.

Best regards,