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

Free Support Forum - aspose.com

Bookmark not defined after mailmerge

I have a Word template used for mail merging via the Java version of Aspose.Words that used to work with version 16.7. Earlier this year we upgraded to version 18.1 and the same template now generates bookmark not defined errors. I noticed that the release notes for Aspose.Words 18.8 have a reference to a fix WORDSNET-16904 which sounds exactly like the problem I am having. However after downloading version 18.8 I am still having the same issue. If I remove the call to updateFields after the mail merge then the generated document does not contain the error message.

Can you confirm that the fix for WORDSNET-16904 is included in the Java release version 18.8. If so it looks like there is another similar issue following a mail merge.


Thanks for your inquiry. Yes, the fix of WORDSNET-16904 issue is included in Aspose.Words 18.8.

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 simple Java 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 will start investigation into your issue and provide you more information. Thanks for your cooperation.

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

I think I have got to the bottom of the problem. It seems there has been a change in our code. The call to updateFields has been introduced recently and this is causing the bookmark error which also does the same thing with the earlier version of the Aspose.Words library. It seems that we are using the “REMOVE_CONTAINING_FIELDS” clean up option and this is removing any SET fields that contain references to mailmerge fields, whereas it does not remove SET fields that contain fixed literals rather than other mailmerge fields. So the end result is that any bookmark that is based on a mailmerge field is removed causing the bookmark error, but bookmarks based on fixed literal values are retained and used correctly. I have modified the code to remove the clean up option and now everything appears to work as expected.

Sorry for the confusion.


Thanks for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.