Page 1 of 1

MailMerger.performMerge after INCLUDETEXT

PostPosted: Fri Sep 05, 2014 5:52 am
by jshuali
I have 2 documents.

Document A has a field: {INCLUDETEXT "document B"}
Document B has many MERGEFIELD's that I like to replace from a Map.

My code runs:

=======================================================================================
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new File("Document A"));
map = ( ... Load some data to a HashMap .... )
MailMerger.performMerge(wordMLPackage, map, true);
=======================================================================================

The generated file has only the field: {INCLUDETEXT "document B"}

What am I missing?

Is MergeDocx Enterprise can help me better?

Re: MailMerger.performMerge after INCLUDETEXT

PostPosted: Fri Sep 05, 2014 12:04 pm
by jason
docx4j does not process/resolve the INCLUDETEXT field at present.

Yes, the MergeDocx machinery in the enterprise edition could be used to process that field (assuming it is inserting a docx file), but I'd need to write some code to make it seamless/easy. Please contact me by email off-list if you'd like to discuss further.

Alternatively, you could use altChunk instead of INCLUDETEXT; if you altChunk is of type docx, the entreprise edition will resolve/process these for you. (altChunks of type XHTML are handled by vanilla docx4j)