JasperReports导出到excel auto size列

我有JRXlsExporter的问题。 自动调整属性无法正常工作。 这是我的jrxml:

              

Java代码:

 excelExporter.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint); excelExporter.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, outputStream); excelExporter.setParameter(JRXlsExporterParameter.MAXIMUM_ROWS_PER_SHEET, 65536); excelExporter.setParameter(JRXlsExporterParameter.IS_IGNORE_CELL_BORDER, Boolean.FALSE); excelExporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); excelExporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); excelExporter.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN, Boolean.TRUE); excelExporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, Boolean.TRUE); excelExporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE); excelExporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); excelExporter.setParameter(JRXlsExporterParameter.IS_IMAGE_BORDER_FIX_ENABLED, Boolean.TRUE); excelExporter.setParameter(JRXlsExporterParameter.IS_IGNORE_GRAPHICS, Boolean.FALSE); 

并输出结果: resultFile 。

例如,第一列必须是“客户编号”而不是“客户编号”

以下属性不适用于报告级别:

   

你必须把它们放在报告元素上(即):

          

另外我建议你尝试使用net.sf.jasperreports.export.xls.column.width属性,这更有用。 参考: http : //jasperreports.sourceforge.net/config.reference.html