Page 1 of 1

Copy a word document into a template place holder.

PostPosted: Tue Apr 30, 2013 6:13 am
by vixmemon
Is it possible to copy all the contents (elements) of a page into another document in place of a Place Holder.

I am using Text Place Holders in template, and i am able to add images, text, paragraphs, tables, on those place holders. I have a requirement, where i have to copy all the pages of a word document (different document) and paste those pages in place of a place holder in template?

Or if i can do it other way around,
breaking the document in two parts, merge it with first part, and them merge all 3 parts.

is it possible?

Re: Copy a word document into a template place holder.

PostPosted: Tue Apr 30, 2013 7:40 pm
by jason
You have 2 options here:

Option 1 is to use an altChunk/AlternativeFormatInputPart, which essentially says "here is my content, and here is where I want it inserted". You then use an altChunk aware processor, such as Word 2010 or MergeDocx, to do the merging work for you. docx4j doesn't process altChunks of type docx by itself (though it can process altChunks of type xhtml).

Option 2 is to do the merge processing, without using an altChunk. You can write code to do this yourself, using the low level facilities docx4j provides, or you could use MergeDocx to do it for you.

MergeDocx is a commercial product which my company sells. If you'd like more information about it, please email sales@plutext.com

For an insight into the issues involved in writing the code yourself, please see http://www.docx4java.org/blog/2010/11/m ... documents/