LINQ Reporting engine throws java.lang.IllegalStateException

Hello,

When accessing fields of array items in a foreach I get an error when the array is empty, even when I put the whole foreach in a conditional checking whether the array is empty.

I’m using:

  • Aspose.Words for Java, v20.6
  • a Word template
  • the ReportingEngine
  • a JsonDataSource

In attachment the Word template and the Java sources of my test (including the JSON input): 220248 case data.zip (10.7 KB)

The error I’m getting is:
java.lang.IllegalStateException: An error has been encountered at the end of expression ‘i.text]>’. Can not get the value of member ‘text’ on type ‘class com.aspose.words.net.System.Data.DataRow’.
at com.aspose.words.internal.zzQC.zzZ(Unknown Source)
at com.aspose.words.internal.zzQC.zzZ(Unknown Source)
at com.aspose.words.internal.zzGH.zzCk(Unknown Source)
at com.aspose.words.internal.zzUP.zzUF(Unknown Source)
at com.aspose.words.internal.zzUP.zzUG(Unknown Source)
at com.aspose.words.internal.zzUP.zzUH(Unknown Source)
at com.aspose.words.internal.zzGH.zzZ(Unknown Source)
at com.aspose.words.internal.zzGH.zzZ(Unknown Source)
at com.aspose.words.internal.zz9F.zzZ(Unknown Source)
at com.aspose.words.internal.zz9F.zzZ(Unknown Source)
at com.aspose.words.ReportingEngine.buildReport(Unknown Source)
at com.aspose.words.ReportingEngine.buildReport(Unknown Source)
at com.aspose.words.ReportingEngine.buildReport(Unknown Source)

How can I solve this?

Kind regards,
Vital D’haveloose
nexuzhealth / UZ Leuven
Belgium

@vdhave0

We suggest you please use ReportBuildOptions as shown below to avoid this exception. Hope this helps you.

final ReportingEngine engine = new ReportingEngine();
engine.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);