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

Free Support Forum - aspose.com

Getting error while adding text to bookmark

Hi Team, I am getting below error while adding black text in bookmark. Could you please help.
Caused by: java.lang.IllegalArgumentException: The reference node is not a child of this node.
at com.aspose.words.CompositeNode.zzXWH(Unknown Source)
at com.aspose.words.CompositeNode.insertAfter(Unknown Source)
at com.aspose.words.Bookmark.zzVV9(Unknown Source)
at com.aspose.words.Bookmark.zzY1x(Unknown Source)
at com.aspose.words.Bookmark.setText(Unknown Source)

I have attached sample code and doc to help with debugging.

We are using latest version : 22.2.0
sample.zip (531.6 KB)

@forasposeissues Thank you for reporting this problem to us. I have managed to reproduce the problem on my side. It has been logged as WORDSNET-23586. We will keep you informed and let you know once it is resolved.

Just to give some input hint. The word developer has added content control in the document, so because of that it might be failing to process. attached the sample doc without content control.input.docx (566.8 KB)

@forasposeissues Thank you for additional information. Yes, we have noticed the problem occurs because bookmark is inside content control. We will deeply investigate the issue and let you know once it is resolved.

Please help with update on this issue, we have to answer back to management with ETA

@forasposeissues The issue is currently in development stage. It is scheduled to be resolved in the next 22.4 version of Aspose.Words. We will be sure to inform you once it is fixed.

The issues you have found earlier (filed as WORDSNET-23586) have been fixed in this Aspose.Words for Java 22.4 update.