Java Reference
In-Depth Information
rtfExporter.exportReport();
System.out.println("Done!");
}
catch (JRException e)
{
e.printStackTrace();
}
}
public static void main(String[] args)
{
new RtfExportDemo().rtfExport(args[0]);
}
}
As we can see in the example,
net.sf.jasperreports.engine.export.
JRRtfExporter
is the
JRExporter
implementation we need to use to export to RTF.
Like the previous example, we tell the exporter what report to export by supplying
an instance of
net.sf.jasperreports.engine.JasperPrint
as the value for the
JRExporterParameter.JASPER_PRINT
parameter, and we set the output file to the
report name by setting the
JRExporterParameter.OUTPUT_FILE_NAME
with the
appropriate value.
The code will generate an RTF document as shown in the following screenshot: