不建议使用JRCsvExporter,JRCsvExporterParameter和新替换示例

时间:2019-07-11 18:13:17

标签: java jasper-reports deprecated

由于已弃用的JRCsvExporter方法和已被setParameter弃用的类的替代,JRCsvExporterParameter的适当用法是什么。

http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRAbstractExporter.html

enter image description here

  JasperReport report = (JasperReport)JRLoader.loadObject(url);

JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, 
                          (JRDataSource)this);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JRCsvExporter exporter = new JRCsvExporter();
exporter.setParameter(JRCsvExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRCsvExporterParameter.OUTPUT_STREAM, baos);
exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, ",");
exporter.exportReport();

0 个答案:

没有答案