Exporting to RTF

Rich Text Format(RTF) is a document file format that is supported by most word processors. Exporting to RTF allows our documents to be read by Microsoft Word and several other word processors.

Note

Unfortunately, RTF documents generated by JasperReports are not always readable by OpenOffice.org or StarOffice writer because these office suites are not fully compliant with the RTF specification. As we'll see in the next section, JasperReports can export to OpenDocument Text, the native format for both of these office suites.

The following example illustrates how to export a report into RTF format:

package net.ensode.jasperbook; import java.io.File; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRExporterParameter; ...

Get JasperReports 3.5 for Java Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.