When I talk about List of Map, this is not images but Map of variables.
In fact i have a docx file that I use as template and that contains variables ${...}.
Then I'd like to merge my template with several set of variables, for example to print a set of letters or something like that.
I would have an utils method that take as parameters a List of Map (List<HasMap<String, String>>).
ok, now i understand
And so I'd like to merge the docx files during the Java merge, but I think it's not as simple than merge the doc part.
See my comments above. If the paragraphs are simple (ie no images, hyperlinks, comments etc) then it is quite easy. You could use something like:
- Code: Select all
List <Object> bodyChildren = getBody(wordMLPackage1).getEGBlockLevelElts();
getBody(wordMLPackage2).getEGBlockLevelElts().addAll(bodyChildren);
private Body getBody( WordprocessingMLPackage wordMLPackage ) {
MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
org.docx4j.wml.Document wmlDocumentEl = (org.docx4j.wml.Document)documentPart.getJaxbElement();
return wmlDocumentEl.getBody();
}
As I mentioned before, things are a bit more complicated if the docs use different styles.
You could manipulate the parts, or possibly use Context Free Chunks: see
http://blogs.msdn.com/brian_jones/archive/2005/07/20/441167.aspxI'd suggest you use the latest build
http://dev.plutext.org/docx4j/docx4j-nightly-20090128.tar.gz