• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to update an RTF template file in java?

 
Rod McLure
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to open an RTF tempalte file and replace strings like "Insert Name here" with data from the database, then write out the new RTF file
I am using Java with Struts.
I don't need to create, or display the RTF template file
google has brought back RTFTemplate but it talks about Spring, Velocity, XML which I would rather not have to get into

Thanks
Rod
 
Martin Vanyavchich
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If files aren't too big and you have figured out how to read them properly, then look into StringBuilder class. That might be the answer.
 
Rod McLure
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no, I haven't figured out how to open or read an RTF file
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A templating engine like Velocity or FreeMarker should do nicely. Spring or any kind of XML needn't be involved.
 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rod McLure wrote:no, I haven't figured out how to open or read an RTF file

An RTF file is a plain text file. Open it in Notepad or any text editor and see for yourself.
 
Rod McLure
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, I found this, does what I want
http://forums.sun.com/thread.jspa?threadID=791257&start=15
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic