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

Free Support Forum - aspose.com

Replacing Text Content of Overlapping Nested Bookmarks in Word DOCM Document using Aspose.Words for Java

We are using Word templates with a lot of overlapping bookmarks in our company. We try to replace the text inside the bookmark from both bookmarks after another.

In both test cases only the text of the first bookmark is replaced and the text of the second bookmark remains in the document. In one case an error occurs.

Before we used Aspose for automation we tried automation with MS-Word and OpenOffice (UNO). With Word and OO the text of the bookmarks is substituted correctly and without error.
We would expect that Aspose would substitute also the text in both bookmarks or removes the text inside both bookmarks and not only one. Please fix it.

I tested it with Aspose-words-21.2.0-jdk17.jar.

Example source code with input and output documents do you find here:
Overlapping Bookmarks with Aspose Java.zip (99.6 KB)

The files “TextOut1 VB.docm” and “TextOut2 VB.docm” are the output with Visual basic macros. They contain the expected output.

“TextOut1.doc” and “TextOut2.doc” are the result with Aspose.

Kind regards
Heiko Voss


We have logged this problem in our issue tracking system. Your ticket number is WORDSNET-21830. We will further look into the details of this problem and will keep you updated here on the status of the linked issue. We apologize for any inconvenience.

Do you have any idea how long it will take until the problem is solved? It is more than one month and the status is still “New”.


WORDSNET-21830 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.

The issues you have found earlier (filed as WORDSNET-21830) have been fixed in this Aspose.Words for .NET 21.8 update and this Aspose.Words for Java 21.8 update.