This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to update an RTF template file in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to update an RTF template file in java?" Watch "How to update an RTF template file in java?" New topic
Author

How to update an RTF template file in java?

Rod McLure
Greenhorn

Joined: Mar 04, 2010
Posts: 24
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

Joined: Sep 16, 2008
Posts: 241
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.


SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
Rod McLure
Greenhorn

Joined: Mar 04, 2010
Posts: 24
no, I haven't figured out how to open or read an RTF file
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41042
    
  43
A templating engine like Velocity or FreeMarker should do nicely. Spring or any kind of XML needn't be involved.


Ping & DNS - my free Android networking tools app
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

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.


luck, db
There are no new questions, but there may be new answers.
Rod McLure
Greenhorn

Joined: Mar 04, 2010
Posts: 24
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.
 
subject: How to update an RTF template file in java?
 
Similar Threads
How to convert a webpage to MS. word
Converting to RTF from the HTML Form Data
Create rtf document from a template
Regarding APIs
Create rtf document based on a template