Java Reference
In-Depth Information
</staticText>
</band>
</title>
<detail>
<band height="100">
<staticText>
<reportElement x="0" y="0" width="555" height="100"/>
<text>
<![CDATA[
Exporting to plain text makes more sense when the report is completely
(or mostly) text.
Since tables and graphical elements don't translate to plain text
very well.
We created this report template to demonstrate exporting to plain text.
Exciting, isn't it?]]>
</text>
</staticText>
</band>
</detail>
</jasperReport>
The following Java code fragment will export the JasperReports' native report
generated by the above JRXML template into plain text:
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.JRTextExporter;
import net.sf.jasperreports.engine.export.JRTextExporterParameter;
import net.sf.jasperreports.engine.util.JRLoader;
public class PlainTextExportDemo
{
public static final String REPORT_DIRECTORY = "reports";
public void plainTextExport(String reportName)
{
File file = new File(REPORT_DIRECTORY + "/" + reportName +
".jrprint");
 
Search WWH ::




Custom Search