• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Best way to 'mail merge' rtf files (including images)

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to generate doc/rtf files based on server data.

I've tried generating the files from scratch using iText. However there are dozens of letter templates to generate, and what takes minutes to design in Word takes hours to design in a Java program. Besides, the boss has just stated that she would like to be able to change the templates herself.

The obvious solution should have been an automated 'mail merge' process, but iText can only write rtf files, not read them. (http://www.nabble.com/Re:-Also---merge-fields-in-RTF--p17925932.html) I would have thought find & replace would have been a much simpler process than generating an rtf from scratch, but so far I haven't managed to find a tool that allows this in a straightforward manner.

RtfTemplate seems to have something to do with what I want, but the 'English' documentation is incomprehensible to me.

At this point we are willing to pay money for an off-the-shelf solution if there is one.

It would need to be able to handle inserting images at marked positions in the document, as well.

[ UD: fixed URL ]
[ December 01, 2008: Message edited by: Ulf Dittmer ]
 
Joe Bloggs
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Help anybody? Is iText getting an update in this direction anytime soon?
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am struggling with the same problem/requirement. Did you find a solution to this?!?
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
iText will never be able to do this; it's a write-only API. While RTFs could be read, altered and changed, PDFs can't, and they are really the root of iText - RTFs are just an add-on.

I'd create the RTFs manually (e.g. using Word), and do the replacements with string/text processing. The elements to be replaced could be marked something like [[name]], [[content]], [[image1]] etc. If the templates are to be altered manually, then the merge code would have to validate them before processing.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try RTFTemplate, its has simple merge feature
 
Marshal
Posts: 66192
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch Burton Rhodes and Anurag Setia.
 
He's dead Jim. Grab his tricorder. I'll get his wallet and this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!