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

Free Support Forum - aspose.com

Problem with showing page numbers in footer

Hi,

We have problem with showing page numbers in footer for some standard MS Word footers where converted from Word to HTML and then back to Word.

Please find simple java program in attachment.


Hi Milan,


Thanks for your inquiry. We will appreciate it if you please share your input and expected Word documents as well. It will help us to investigate your issue exactly and address it accordingly.

Best Regards,

Hi,

I am attaching simple Java program which simulates issues. Also, I am attaching expected behavior for both scenarios. Input html is included in application source file.

File first.docx is document with issue and file first_expected_behavior.docx is document with expected behavior. Same thing is for file second.docx

I am using Aspose.Words for Java 17.3.0

Hi Milan,


Thanks for sharing additional information. Please note there is no concept of pages in simple HTML files. Please try saving to HtmlFixed format instead by using the following code. Hopefully it will resolve the issue.

Document doc = new Document(“input.docx”);<o:p></o:p>

HtmlFixedSaveOptions opts = new HtmlFixedSaveOptions();

// Specify options as required

doc.save("AW_175.html", opts);


Best regards,

Hi,

You can see issues in source code than I attached in previous post. It is obvious that page numbers and not updated correctly, it is always number 1 for some MS Word standard footer options.

Issue here is with page numbers in footer section. This is nothing to do with concept of pages in simple HTML. I am talking about style attribute with ‘<span style=“color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>-aw-headerfooter-type:footer-primary’.

<span style=“color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>
<span style=“color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>
I am attaching working example (just with page numbers in footer). It this case page numbers are showing correctly but for the other scenarios it is not working.

Can you check source code that I attached and examples which are not working properly?

Note: I am attaching again source code.

Also, you can find files first.docx and second.docx which have issue and files first_expected and second_expected.docs which represent expected behavior.

File third.docx is example which works as expected.

Regards<span style=“color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>





Hi Milan,


Thanks for your feedback and sorry for the confusion. I have again tested the scenario and noticed the reported incorrect page numbers issue in footer. We have logged following tickets in our issue tracking system for further investigation and rectification. We will notify you as soon as these are resolved.

WORDSJAVA-1589: Incorrect page number in footer- Case1
WORDSJAVA-1590: Incorrect page number in footer- Case2

Furthermore, as a workaround you can move PAGE field out of
. However, we will notify you as soon as above logged issues are fixed in API.

We are sorry for the inconvenience.

Best Regards,

The issues you have found earlier (filed as WORDSJAVA-1589,WORDSJAVA-1590) have been fixed in this Aspose.Words for .NET 18.7 update and this Aspose.Words for Java 18.7 update.