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

Free Support Forum - aspose.com

Error when inserting checkox

I have updated to the latest aspose version (coming from one of the latest pure java builds).
Now I have a problem inserting checkboxing using a IFieldMergingCallback. With our last version the function was working.
Here the code I am using:
public void fieldMerging(FieldMergingArgs fieldMergingArgs) throws Exception {
if (fieldMergingArgs.getFieldValue() instanceof Boolean) {
try {
String checkBoxName = MessageFormat.format("{0}{1}", fieldMergingArgs.getFieldName(),
// Insert a check box.
documentBuilder.insertCheckBox(checkBoxName, (Boolean) fieldMergingArgs.getFieldValue(), 0);
} catch (Exception e) {
throw new DocumentConvertingException(“Unable to create checkbox for boolean merge field.”, e);

The value of the fieldMergingArgs is a Boolean.

Now the follwoing exception is raised:

java.lang.IllegalStateException: Cannot find bookmark ‘fieldName0’ in the document.
at com.aspose.words.zzZR.zzX(Unknown Source)
at com.aspose.words.Bookmark.getBookmarkEnd(Unknown Source)
at com.aspose.words.Bookmark.setName(Unknown Source)
at com.aspose.words.FormField.setName(Unknown Source)
at com.aspose.words.DocumentBuilder.insertCheckBox(Unknown Source)
at com.werum.proreg.officeprintout.template_administration_server.internal.BooleanMergeFieldHandler.fieldMerging(BooleanMergeFieldHandler.java:67)
… 69 more

while “fieldName” is the name of the mail merging field in the template.

Can anyone give my any hint why this is not working anymore?

Best regards

Hi Sascha,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

  • Please attach your input Word document.
  • Please

    create a standalone/runnable simple Java application that demonstrates the code (Aspose.Words code) you used to generate
    your output document

As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

sorry for the delayed answer. Attached you’ll find the code and the used Word input document.
The java file is suffixed with .txt.

Best regards

Hi Sascha,

Thanks for sharing the detail. I have tested the scenario using latest version of Aspose.Words for Java 14.11.0 and have not found the shared issue. Please use Aspose.Words for Java 14.11.0. I have attached the output document with this post for your kind reference.