wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Best way to handle RTF data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Best way to handle RTF data" Watch "Best way to handle RTF data" New topic
Author

Best way to handle RTF data

Kelly Boyd
Greenhorn

Joined: Apr 28, 2012
Posts: 2
Hello,

I have a database that collects information from various sources. Then a Java application (1.4.2) is used to view the data from the database. One source of data wants to send RTF documents that are highly formatted - including headers and footers, tables, highlighting, etc. Initially I tried to use a the javax.swing.jeditorPane to display these RTF documents, but this does not seem to be capable of handling the headers, footers and tables properly. The text is displayed, but not with the correct alignment. If the rtf data is opened in Word 2007 it looks very nice, (looks pretty good in Word 2003). The data needs to be view only and printable in the Java application. I looked at one 3rd party RTF editor that seemed to handle creating the tables correctly, but the height of the cells was off, so the bottom half of words were hidden.

What would you recommend as the best approach to capture and display this RTF data? Were there later versions of the RTFEditor that could handle tables, headers and footers? Should I try to convert it to another format that a jeditorPane component can display more easily while still retaining the formatting? What format would that be? Should I try to find another 3rd party RTF Editor? Would somehow calling the MS Word Viewer be possible/best?

Thank you very much for your thoughts on this!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41182
    
  45
First off, RTFEditor has been in the sorry state it's in for years, and (I predict) will not improve.

Open source and commercial viewer components exist for other formats, though. Lobo (on SourceForge) for HTML, and PDFRenderer (on java.net) come to mind. Those might be viable if you convert the RTF to those other formats, possibly using OpenOffice in server mode via the JODConverter library. I'm not sure if they run on Java 1.4, though, which has been dead for yerars (and which you should replace by at least Java 6 ASAP; there are security problems with those old JVMs, and they are not getting fixed).

Also, if you were using at least Java 6, you could just call java.awt.Desktop.open(...) to use whatever client-side application is available to view those documents, no matter what format they're in.


Ping & DNS - my free Android networking tools app
 
 
subject: Best way to handle RTF data
 
Similar Threads
Converting RTF to XSL-FO
Urgent! Help Needed...Dealing with rtf in Java
How to create MSWORD doc and open the doc in jsp?
saving a html file as word document on click of a button
Best format for outputting large reports - 300MB+