English 中文(简体)
《贾斯珀报告》中每一表单财产一页
原标题:One page per sheet property in JasperReports

我在Jasper Reports中需要设计一个报告。 报告有4页。 第一份有5页, 类似的报告有1页或2页。 我面临的问题是如果我使用“ 坚固” net. sf.jasperreports.export. x.ls. one. page. per. sheit , 然后所有页面都以不同页形式出现。 我需要设计报告的方式, 使某些页面能够以相同的表格形式出现, 一些页面也可以以不同的表格形式出现 。

有可能这样做吗?

问题回答

假设您有四份单独的批量导出报告,那么在每份报告中,您需要将 Ignore pagination 设置为 true (这是jrxml文件草签时 Jasper Report 标签中的一个属性, 属性看起来像 is IgnorePagination=" true" )。

要实际出口,它应该看起来类似:

List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();
jasperPrintList.add(JasperFillManager.fillReport("report1.jasper", params1));
jasperPrintList.add(JasperFillManager.fillReport("report2.jasper", params2));
jasperPrintList.add(JasperFillManager.fillReport("report3.jasper", params3));
jasperPrintList.add(JasperFillManager.fillReport("report4.jasper", params4));

JRXlsExporter exporter = new JRXlsExporter();

exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, jasperPrintList);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "BatchExportReport.xls");
exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);

exporter.exportReport();

要设置工作单名称,请查看动态工作表名称 在JasperForge的示例。


According to your comment you are wanting to use the same report templates to export to multiple formats. With excel being the only one that needs to ignore pagination. What you can do is set via a parameter at runtime instead of hardcoded in the report. So add the following to the params1,params2,params3,and params4:
if(exportFormat == EXCEL) {
   params1.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);
   params2.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);
   params3.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);
   params4.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE);
}




相关问题
import of excel in SQL imports NULL lines

I have a stored procedure that imports differently formatted workbooks into a database table, does work on them then drops the table. Here is the populating query. SELECT IDENTITY(INT,1,1) AS ID ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

Excel date to Unix timestamp

Does anyone know how to convert an Excel date to a correct Unix timestamp?

C# GemBox Excel Import Error

I am trying to import an excel file into a data table using GemBox and I keep getting this error: Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1. As ...

Importing from excel "applications" using SSIS

I am looking for any tips or resources on importing from excel into a SQL database, but specifically when the information is NOT in column and row format. I am currently doing some pre-development ...

热门标签