相关疑难解决方法(0)

贾斯珀报告缺少第一排

我正在使用JasperReports生成一个报告,并假设将其导出为多种格式.但目前我只使用excel报告.

这是我的控制器代码.

    InputStream in = reportTemplate.getTemplate(reportInquery.getTemplateFile());
    JasperPrint print = JasperFillManager.fillReport(in, null,
                new JRResultSetDataSource(reportDao.getReportData(reportInquery)));
    resp = HttpConfig.setHeaders(reportInquery, resp);
    Exporter exporter = reportOption.getRenderOptions(reportInquery.getFormat(), resp.getOutputStream(), print);
    exporter.exportReport();
Run Code Online (Sandbox Code Playgroud)

在我的配置工厂中,excel报告在调用getRenderOptions方法后配置如下.

    public Exporter exporterOptions(OutputStream outputStream, JasperPrint print) {
    JRXlsExporter exporter = new JRXlsExporter();
    exporter.setExporterInput(new SimpleExporterInput(print));
    OutputStreamExporterOutput outputStreamExporterOutput = new SimpleOutputStreamExporterOutput(outputStream);
    exporter.setExporterOutput(outputStreamExporterOutput);
    SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
    configuration.setOnePagePerSheet(true);
    configuration.setDetectCellType(true);
    configuration.setMaxRowsPerSheet(100);
    configuration.setRemoveEmptySpaceBetweenColumns(true);
    configuration.setRemoveEmptySpaceBetweenRows(true);
    exporter.setConfiguration(configuration);
    return exporter;
}
Run Code Online (Sandbox Code Playgroud)

创建JRResultSetDataSourceOracleCachedRowSet在上面的getReportData方法中使用了oracle .

public RowSet getReportData(ReportInqueryDTO reportInquery) {
    try {
        String query …
Run Code Online (Sandbox Code Playgroud)

java jasper-reports

4
推荐指数
2
解决办法
4923
查看次数

标签 统计

jasper-reports ×1

java ×1