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!
Joined: Mar 22, 2005
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.