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

Free Support Forum - aspose.com

Nullpointer with word expression fields & mailmerge execution

Dear Aspose team,

one of our customizers gets a nullpointer when executing mailmerge:

Caused by: java.lang.NullPointerException
at com.aspose.words.abl.a(NodeCopier.java:45)
at com.aspose.words.abl.b(NodeCopier.java:72)
at com.aspose.words.abp.MF(NodeRangeResultApplier.java:31)
at com.aspose.words.og.ME(FieldResultApplier.java:42)
at com.aspose.words.oy.perform(FieldUpdateActionApplyResult.java:97)
at com.aspose.words.Field.b(Field.java:472)
at com.aspose.words.Field.a(Field.java:390)
at com.aspose.words.pi.a(FieldUpdater.java:154)
at com.aspose.words.pi.m(FieldUpdater.java:107)
at com.aspose.words.pf.execute(FieldUpdateExecutionItem.java:82)
at com.aspose.words.pi.ir(FieldUpdater.java:97)
at com.aspose.words.pi.a(FieldUpdater.java:73)
at com.aspose.words.zi.a(MailMergeRegion.java:297)
at com.aspose.words.zi.Zw(MailMergeRegion.java:273)
at com.aspose.words.zi.a(MailMergeRegion.java:71)
at com.aspose.words.MailMerge.execute(MailMerge.java:253)
at com.aspose.words.MailMerge.execute(MailMerge.java:278)

The problem are fields in the template using Word’s expressions( WHEN formulars). If one of the mailmerge fields, which is used in the WHEN formular, returns null (null is allowed during normal mailmerge execution), then the nullpointer exception occurs.

Thanks for responding.
Kind regards,


Thanks for your inquiry. Could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.

Thank you for replying. As attachment you’ll find the requested word template.

Kind regards!

Hi Jens,

Thanks for sharing the file. Perhaps, you’re using an older version of Aspose.Words; as with Aspose.Words v11.9.0, I am unable to reproduce this problem on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v11.9.0 and let us know how it goes on your side. I hope, this will help.

Thanks a lot. Yes we are using 10.7.

So I will discuss the upgrade option. Thank you again!

Kind regards,

Hi Jens,

Thanks for your feedback. Please use the latest version Aspose.Words for Java and let us know if you have any more queries.