我正在使用动态报告创建报告,并且能够创建报告。但问题是当我将其转换为excel时,excel中的单元格显示警告为存储为文本的数字。因此,无法进行任何操作。
这是我的代码
File file = new File("c:/report.xls");
JasperXlsExporterBuilder xlsExporter = export.xlsExporter(file).setDetectCellType(true).setIgnorePageMargins(true)
.setWhitePageBackground(false).setRemoveEmptySpaceBetweenColumns(true);
report.addProperty(JasperProperty.EXPORT_XLS_FREEZE_ROW, "2").ignorePageWidth().ignorePagination().toXls(xlsExporter);
如何删除此错误。
答案 0 :(得分:0)
在代码中添加以下行:
<property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
修改强>
在Dynamic Reports samples中,报表变量还会设置以下内容。这可能有助于取决于专栏。
.columns(
itemColumn,
col.column("Quantity", "quantity", type.integerType()),
col.column("Unit price", "unitprice", type.bigDecimalType()))