Certain fields in header and footer not updating

Certain embedded MS Word fields in headers and footers are not being updated in recent versions of Aspose.Words during word merges. When I do a merge using v15.3, everything works fine. When I updated to 17.10, this problem surfaced. I have a test case prepared, but do not see a way to attach it to my post.

@dspector1,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

TestCase11.zip (113.0 KB)

Note that I removed the contents of CSharp\packages\Aspose.Words.17.10 to reduce zip size.

When you run this test case, you will see in the generated MergeOutput.docx file that two out of the three identical file reference includes on the page end up as “Error! Not a valid filename”. The ones in error are in the header and footer. This worked in Aspose 15.3. It appears it worked until 15.6. In version 15.7, all three of these includes fail. It stayed this way until 15.10, where they all worked. In 15.12, the body include worked, but the header and footer ones no longer did. I believe it has been this way ever since. We just noticed it because we want to upgrade from 15.3 to 17.10, but cannot.

@dspector1,

Thanks for sharing the detail. Please note that Aspose.Words mimics the same behavior as MS Word does. If you update the fields using MS Word for documents generated by Aspose.Words 17.10 and 15.3, you will get the same output.

The issue with output document is MailMergeCleanupOptions.RemoveStaticFields updates the FileName field codes incorrectly. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15973. You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

Please remove MailMergeCleanupOptions.RemoveStaticFields from the cleanup options to get the correct output. Hope this helps you.

I have tested your workaround and it does result in the proper output being produced. Rather than using this workaround in our production environment, we will stay with version 15.3 until a fix for WORDSNET-15973 is released. At that time, we will upgrade to that version. Thank you.

@dspector1,

Thanks for your feedback. We will inform you via this forum thread once this issue is resolved. Please let us know if you have any more queries.

@dspector1,

The issues you have found earlier have been fixed in this Aspose.Words for .NET 17.11 update and this Aspose.Words for Java 17.11 update.

Please also check the following articles: