|
|
@@ -62,6 +62,7 @@ import net.sf.jasperreports.engine.JasperReport;
|
|
|
import net.sf.jasperreports.engine.design.JasperDesign;
|
|
|
import net.sf.jasperreports.engine.export.JRPdfExporter;
|
|
|
import net.sf.jasperreports.engine.export.JRRtfExporter;
|
|
|
+import net.sf.jasperreports.engine.export.JRTextExporter;
|
|
|
import net.sf.jasperreports.engine.export.JRXlsExporter;
|
|
|
import net.sf.jasperreports.engine.xml.JRXmlLoader;
|
|
|
import net.sf.jasperreports.export.ExporterInput;
|
|
|
@@ -203,6 +204,8 @@ public class PrintServiceImpl implements PrintService {
|
|
|
exportReportToXls(jasperPrint, outputStream, customCellStyle);
|
|
|
} else if (exportFileType.equals(ReportConstants.FILE_TYPE_WORD)) {
|
|
|
exportReportToDoc(jasperPrint, outputStream);
|
|
|
+ } else if (exportFileType.equals(ReportConstants.FILE_TYPE_TEXT)) {
|
|
|
+ exportReportToText(jasperPrint, outputStream);
|
|
|
} else {
|
|
|
exportReportToPdf(jasperPrint, outputStream, pageIndex);
|
|
|
}
|
|
|
@@ -567,6 +570,22 @@ public class PrintServiceImpl implements PrintService {
|
|
|
exporter.exportReport();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 以text的格式导出报表
|
|
|
+ *
|
|
|
+ * @param jasperPrint
|
|
|
+ * @param outputStream
|
|
|
+ * @throws JRException
|
|
|
+ */
|
|
|
+ private void exportReportToText(JasperPrint jasperPrint, OutputStream outputStream) throws JRException {
|
|
|
+ JRTextExporter exporter = new JRTextExporter();
|
|
|
+ ExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
|
|
|
+ exporter.setExporterInput(exporterInput);
|
|
|
+ WriterExporterOutput exporterOutput = new SimpleWriterExporterOutput(outputStream);
|
|
|
+ exporter.setExporterOutput(exporterOutput);
|
|
|
+ exporter.exportReport();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 移除除了Column Header和Detail之外的元素
|
|
|
*
|