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

Free Support Forum - aspose.com

Document with lots of text not merging

Hi


The document attached contains 15 pages out of which 6 pages are of text and remaining pages has fileds and mail merge doesnt work.I tried to remove the 3 pages of text and it worked .I also added some fields at the top of the page and it worked.The mailmerge is not working when there are more text pages.We are using full license.We want to fix this for the customer and we would appreciate any help.

Thanks.

Hi Eamonn,


Thanks for your inquiry.

After an initial test with Aspose.Words for Java 14.4.0, I was unable to reproduce this issue on my side (please see attached out.pdf). I would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link. I hope, this helps.
http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/default.aspx

I have used the following code to produce out.pdf:
Document doc = new Document(getMyDir() + “RC+Lim.doc”);
doc.getMailMerge().execute(new String[] { “Comp_Name” }, new Object[] { “ABC” });
doc.save(“C:\temp\out-java.pdf”);
Best regards,

Hi,


I have downloaded the 14.4.1 it says this is a hot-fix, I assume it is OK to use in production, or should we use 14.4.0?

The problem we are having is actually the call to get the mail merge fields from the template
docTemplate.getMailMerge().getFieldNames()
is just returning an empty array.

We use the mail merge fields names in the document to build our data source. Can you look into this?

Thanks,
Eamonn

Hi Eamonn,


Thanks for your inquiry. When using the following code, Aspose.Words for Java 14.4.0 correctly returned 447 merge fields in your shared document on my side:
Document doc = new Document(getMyDir() + “RC+Lim.doc”);
String[] fields = doc.getMailMerge().getFieldNames();
for (String mf : fields)
System.out.println(mf);
System.out.println("Count: " + doc.getMailMerge().getFieldNames().length);
Regarding the usage of ‘interim build’, the hotfix (14.4.1) released during the month was only meant for a particular few customers who required it. We strongly recommend you use the official 14.4.0 release on your production environment.

If we can help you with anything else, please feel free to ask.

Best regards,

Hi Awais,

I have the same code and same template but I get an empty array, I don’t understand how this can happen. I am using the 14.4.0 release jar file.

It only works when I delete a few pages of text from the document, so is there some buffer limit perhaps?

Thanks,
Eamonn

Hi Eamonn,


Thanks for the additional information. It seems you’re using Aspose.Words for Java in evaluation mode. If you want to test Aspose.Words without the evaluation version limitations, please request a 30-day temporary license. Please visit the following links for details:

http://www.aspose.com/docs/display/wordsjava/Evaluate+Aspose.Words
http://www.aspose.com/docs/display/wordsjava/Applying+a+License

I hope, this helps.

Best regards,

Hi Awais,


No, we have a full license, this is a production/customer issue we’re trying to address.

Thanks,
Eamonn

Hi Eamonn,


Thanks for your inquiry. You need to apply license before creating Document class instance. Can you please run the following code on your side and see how it goes?
License lic = new License();
lic.setLicense(getMyDir() + “Aspose.Total.Java.lic”);

Document doc = new Document(getMyDir() + “RC+Lim.doc”);
String[] fields = doc.getMailMerge().getFieldNames();
for (String mf : fields)
System.out.println(mf);
System.out.println("Count: " + doc.getMailMerge().getFieldNames().length);

Best regards,

Hi,


Yes you are correct, our spring bean that creates the data source was not calling the init method to load the license, it was only loading the license for the mail merge process itself.

Cannot believe I didn’t spot this before :), but thanks as when I seen your snippet above the penny dropped. Apologies for wasting your time.

Thanks,
Eamonn

Hi Eamonn,


It is great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,