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;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.export.JRRtfExporter;
import net.sf.jasperreports.engine.util.JRLoader;
public class RtfExportDemo
{
public static final String REPORT_DIRECTORY...