Mail Merge into RTF with nested tables

My company develops CRMs and, as a result, we upload hundreds of templates to be used during several mail merging processes. Most templates appear to load successfully with the aspose.words for Java API, however, credit application templates generated with Microsoft Word and containing complex nested tables (and saved as RTF documents) don’t appear to work. In fact, when loading the template all parent and nested tables containing mergeable fields appear to be purged from the document and I can’t figure out why. I’m attaching the document and identifying the code used for the loading/merging below. Any help would be appreciated as $3k is alot to invest into a product that only meets 65% of our needs. Thanks.
Template Loading Code: (this code attempts to load all fields in the document from the template for other processing, then performs the merge. What’s happening is that none of the fields within the nested tables are being recognized as it was purged during the original loading of the Document class)

ByteArrayInputStream is = new ByteArrayInputStream(templateData);
LoadOptions lo = new LoadOptions();
lo.setLoadFormat(LoadFormat.RTF);
Document doc = new Document(is,lo);
MailMerge mm = doc.getMailMerge();
mm.setUseNonMergeFields(true);
mm.setCleanupOptions(MailMergeCleanupOptions.NONE);
String[] fieldNames = mm.getFieldNames();
for (String fieldName : fieldNames){
... Do Other Processing...
}
mm.execute(fieldNames,getFieldValues());

Hi
Ashruf,

Thanks for your inquiry. First, I would suggest you please use the latest version of Aspose.Words i.e. 11.6.0 and let us know how it goes on your side? You can download it from the following link:
https://releases.aspose.com/words/java

Secondly, if the problem still remains, please do the following:

Attach your output Word document.
Highlight the problematic areas in that document.
Share the complete code to be able to reproduce the same problem(s) on my side

Best Regards,

Thanks Awais for getting back to me quickly.
Firstly, I am using the most recent version of the API. Secondly, I’m reattaching the original template (CreditApplication.rtf) as well as the template after merge (CreditApplicationAfterMerge.rtf). Thirdly, the problem areas are all tags in the table. The only tag that gets substituting during the mail merge is [StoreName]. The rest of the document gets purged (i.e. removed) and i don’t know why. Lastly, the code in the original posting is the code I used to perform the mail merge. The rest of the code is unnecessary as the core of the document is already deleted when I create the instance of the Document class from a byte input stream. Thanks.

Hi
Ashruf,

Thanks for the additional information.

Most likely, you’re using Aspose.Words in evaluation mode and your document is truncated. There is an evaluation limitation of maximum number of paragraphs in the document. Please read the following article for more details:
<“Licensing and Subscription|Aspose.Words for .NET”>

Please let us know if you need more information, we are always glad to help you.

Best Regards,

Hi Awais-
Thanks for the response. While it is true I’m still in evaluation mode, as you stated, there’s only a limit on number of paragraphs. What happened to the table (and all cells within that table)? You’re basing your conclusions on assumptions and not actual facts. Did your team get a chance to execute the template and see if it does, indeed, work in licensed mode or if it is the evaluation mode that is removing the table(s)? I can’t invest $3000 on ‘most likely’ scenarios. If your team can successfully test this BASIC template (in non-evaluation, licensed mode), I will purchase this product. Thanks.
-Ashruf

Hi Ashruf,

Thanks for the additional information and your interest in Aspose.Words.

Ashruf:
Did your team get a chance to execute the template and see if it does, indeed, work in licensed mode or if it is the evaluation mode that is removing the table(s)?

Yes, I did test your template and executed the code you provided to produce a perfect RTF output on my side. I have attached a couple of RTF documents, i.e. generated with and without applying the license, here for your reference. This confirms that there is no problem in licensed mode.

Ashruf:
While it is true I’m still in evaluation mode, as you stated, there’s only a limit on number of paragraphs. What happened to the table (and all cells within that table)?

It seems, in evaluation mode, Aspose.Words simply removes the Tables inside your Word document during loading into DOM. Your request has been linked to the appropriate issue (WORDSNET-6188) in our issue tracking system and you will be notified as soon as it is resolved. Sorry for the inconvenience.

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

Best Regards,

Thank you Awais for all the trouble you’ve gone through to resolve my issue. I was just ensuring that all our needs, not just a fraction, were met. The price is steep for only meeting a percentage of our needs, but a bargain for meeting all of them. We’ll be purchasing it this evening. Many thanks again.
Regards,
-Brian

Hi Brian,

Thanks for considering Aspose.Words. If you want to test Aspose.Words without the evaluation version limitations, you can request a 30-day Temporary License. Please refer to How to get a Temporary License? You can also contact our sales team directly by using this forum here.

Best Regards,

The issues you have found earlier (filed as WORDSNET-6188) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(1)