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());