Header and footer changed on printing or conversion to PDF

Hello,
we have a word template with filable fields in the document (variables in header, footer and in the page)
We are using library com.aspose.words.Document : we replace these fields by values with function document.getRange().replace.
The word generated seems correct but as soon as we try to print or save this docx into pdf, then header and footer are changed : back to filable fields instead of values set.
That’s very strange, as all the body is kept with values. This issue is only hapenning on headers & footers.
Did you already experienced this issue ? Any idea how to solve it ?
Thanks

In addition, for information, we’re coding in JAVA. Thanks

I could share with you the docx generated. So you can see headers and footers seem ok but as soon as we print or save as PDF, they disapear for filable fields.

@lazarides,
You may share your word template file, a runnable console application which can be compiled and executed without any missing reference and program output files word/pdf both for our reference. We will try this scenario by reproducing this issue here and share our feedback accordingly.

Hello, please find in copy template and document generated.
You can see Document_generated.docx is correctly displayed, but when you try to print or save in PDF the footer change.
Thanks

Documents.zip (120.0 KB)

@lazarides,

We have logged this problem in our issue tracking system with ID WORDSNET-21676. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

Hello,
Does it mean you confirm there’s a bug in the library that needs to be fixed ?
As we’re using it in production, would you have any idea of workaround waiting on a fix ?
Thanks
Stephane

@lazarides,

Yes, we will fix the problem/bug in future versions of Aspose.Words’ API. WORDSNET-21676 is currently pending for analysis and is in the queue. There are no estimates available at the moment. Once the analysis of this issue is completed and the root cause is determined, we may then be able to calculate and share the ETA of this issue with you… We apologize for any inconvenience.

Ok thanks for info.
Would you just have an idea of delay on such issue ?
I mean, should we have more details in coming days or could it be weeks/months ?
It’s considered as critical bug on our application by business team as they can’t produce PDF. So if too long, that would mean we need to find in urgency another solution.
Best regards
Stéphane

@lazarides,

The issue you reported yesterday (WORDSNET-21676) is currently pending for analysis and is in the queue. I am afraid, there is no ETA (time frame) available at the moment. The resolution time depends upon the complexity of the issue. Generally speaking, we work on issues on a first come, first served basis as we feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers. We have logged your concerns in our issue tracking system and will be sure to inform you via this forum thread as soon as your issue will get resolved in future or any ETA/workaround may be available. We apologize for any inconvenience.

Hi,
do you have any update on it ?
It’s raised as critical issue internally. Teams are requesting that we change library if not possible to manager header and footer as it’s considered as basics functionalities.
Would it be possible to have an expert helping us quickly ? (and if we need to pay for that it’s possible)
Thanks
Stéphane

@lazarides,

Regarding WORDSNET-21676, during further investigation, we have concluded that this is actually not a problem in Aspose.Words.

The problematic document has few merge fields in one of the footers (section 2 footer displayed on page 2). On opening the document, MS Word displays the field result values in the footer. On going to print preview or saving to PDF, MS Word displays field names instead of field results. As far as we understand, you are reporting about this MS Word behavior. Aspose.Words layout is not involved in the scenario. (In fact, Aspose.Words saves the document to PDF with field results in the problematic footer, so Aspose.Words PDF output matches your expectations but it does not match MS Word PDF output. However, it seems that it is MS Word’s behavior that you are not happy with).

We suggest you to please change your approach to field value replacement. Using mail merge and reporting features instead of range.replace should remove the problematic fields and the problem may go away.

Alternatively, you can lock the merge fields programmatically after performing your range replacement operation.

Simply converting "Document_generated.docx’ to PDF format (see awjava-21.1.pdf (65.2 KB)) shows the result/values of fields in footer.

Document doc = new Document("C:\\Documents\\Document_generated.docx");
doc.save("C:\\Documents\\awjava-21.1.pdf");

On the other hand, MS Word 2019 updates merge fields in headers/footers and reverts the results. I am attaching a PDF generated by MS Word 2019 confirming that (see msw-2019.pdf (70.8 KB)).

Please let us know if we can be of any further assistance.