Mail merge loses formatting information?
Posted: Tue Apr 24, 2012 9:00 pm
I'm using docx4j to fill out mergefields in a template document. Unfortunately, the merge process seems to lose a lot of formatting (whether or not the
This is a (decrufted) version of the code I am using:
Any suggestions?
I also have a bonus question: is it possible to merge text into a field which contains linebreaks, so that the text shows up on multiple lines after merging?
- Code: Select all
\* Mergefield
This is a (decrufted) version of the code I am using:
- Code: Select all
import org.docx4j.model.fields.merge.MailMerger;
InputStream body; // assigned elsewhere
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(body);
//mail merge
WordprocessingMLPackage merged = MailMerger.getConsolidatedResultCrude(wordMLPackage, translations_wrapped);
Any suggestions?
I also have a bonus question: is it possible to merge text into a field which contains linebreaks, so that the text shows up on multiple lines after merging?