1
votes

I have a word document in the format of a docx, created in Word 2007. I need to open this document and at certain places in the document add Text, Images and tables.

I also need to do the same thing with a Powerpoint.

I've seen solutions when googling where they used strings in the document and search and replaced them. I don't think thats the way to do it.

Another solution I found was that of inserting bookmarks in the word document and then append data after the bookmark. This was done with the Apache POI library. This solution looks better. But what happens if I need to put the same data in different parts of the document. I don't want to define multiple unique bookmarks for inserting the same data.

So basically I'm looking for a way to create a word template and define keywords where I can inject data.

Update Found this http://code.google.com/p/xdocreport/ and it did almost exactly what I wanted.

2
I should investigate Word fields. If you can define some given fields, you can insert them several times. And I guess POI library could manage fields with relative ease. But it's just a guess.helios
@helios The xdocreport library uses word fields as you mentioned.heldt

2 Answers

1
votes

You might want to also look at Docmosis and JODReports since they can do document generation from Doc/DocX templates. They use placeholders to do exactly what you are after. They can also do tables/headers/footers/images etc. Please note I work for the company that produces Docmosis.

0
votes

Another solution could be to use ContentControls mapped to CustomXMLParts - that way you could update the XML from outside of MS Word and/or PowerPoint (e.g. Java) and the content inside would be updated automatically.