Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Mon Sep 09, 2024 10:03 pm

We just purchased a license for Spire.DOC (Java).
When using the free version we build a solution that extracted data from a .json file and we could merge that data into our Word-template.
Code: Select all
           
            com.jayway.jsonpath.JsonPath jsonPath = com.jayway.jsonpath.JsonPath.compile(mergeField.getFieldName());
            List<Map<String, Object>> dataMap = documentContext.read(jsonPath);
            MailMergeDataTable mailMergeDataTable = new MailMergeDataTable(mergeField.getFieldName(), dataMap);
            try {
                targetDocument.getMailMerge().executeGroup(mailMergeDataTable);
            } catch (Exception e) {
                // just ignore;
            }


After upgrade to the 12.9.0, the exact same code throws an exception. See below.
I think it has to do with the fact that the Map cannot be handled correctly. This because by executing the code using a List of 'classes', it works as expected. However, we are building a generic solution, so we don't know which 'class' is to be merged. And in the free-version it worked perfectly. I was expecting to use exactly the same code after buying a license.

We are moving from a Proof-of-Concept to Production phase. So it is important to have this fixed quickly.

Code: Select all
java.lang.NullPointerException: Cannot invoke "com.spire.doc.packages.sprztp.spr⌨§(int)" because "this.spr—" is null
   at com.spire.doc.packages.sprhay.spr┽’(Unknown Source)
   at com.spire.doc.reporting.MailMerge.spr┽▒(Unknown Source)
   at com.spire.doc.reporting.MailMerge.spr㈮⃞▔(Unknown Source)
   at com.spire.doc.reporting.MailMerge.spr┾▓(Unknown Source)
   at com.spire.doc.reporting.MailMerge.spr┱▔(Unknown Source)
   at com.spire.doc.reporting.MailMerge.spr▒▔(Unknown Source)
   at com.spire.doc.reporting.MailMerge.spr⁆▔(Unknown Source)
   at com.spire.doc.reporting.MailMerge.spr┋▒(Unknown Source)
   at com.spire.doc.packages.spracs.spr╻▒(Unknown Source)
   at com.spire.doc.packages.sprctr.spr㈫⃡▒(Unknown Source)
   at com.spire.doc.packages.sprctr.spr⅝▒(Unknown Source)
   at com.spire.doc.packages.sprctr.spr┛▒(Unknown Source)
   at com.spire.doc.packages.sprctr.spr⅝▒(Unknown Source)
   at com.spire.doc.packages.sprctr.spr●▒(Unknown Source)
   at com.spire.doc.reporting.MailMerge.spr⅔▓(Unknown Source)
   at com.spire.doc.reporting.MailMerge.spr┤▔(Unknown Source)
   at com.spire.doc.reporting.MailMerge.executeGroup(Unknown Source)

jvkampen1970
 
Posts: 1
Joined: Mon Sep 09, 2024 9:48 pm

Tue Sep 10, 2024 10:04 am

Hello,

Thanks for your inquiry.I created a List<Map<String, Object>>data structure and added some simulated data to it, then ran your code, but the result did not report any exceptions. So in order to help us solve your problem faster and more accurately, please provide us with your Word template and complete testing code for investigation, especially the 'documentContext. read()' method.You can send it to us via email( support@e-iceblue.com ). Thank you in advance.

Sincerely,
Amin
E-iceblue support team
User avatar

Amin.Gan
 
Posts: 277
Joined: Mon Jul 15, 2024 5:40 am

Wed Sep 11, 2024 5:46 am

Hello,

Thank you for providing the information. I have reproduced this issue using your document. This issue has been logged in our bug tracking system under the number SPIREDOC-10825,and its priority has been set to the highest. Our Dev team will investigate it further, once there is any update, we will let you know. If you have any other questions, please feel free to write to me.

Sincerely,
Amin
E-iceblue support team
User avatar

Amin.Gan
 
Posts: 277
Joined: Mon Jul 15, 2024 5:40 am

Return to Spire.Doc

cron