在使用 DynamicReports 创建的 Excel 中存储为文本的数字
Number Stored as Text in Excel created using DynamicReports
我正在使用动态报告创建报告并且能够创建它。但问题是,当我将它转换为 excel 时,excel 中的单元格显示警告为 Number Stored as Text。因此无法进行任何操作。
这是我的代码
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);
如何消除这个错误。
将以下行添加到您的代码中:
<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()))
我正在使用动态报告创建报告并且能够创建它。但问题是,当我将它转换为 excel 时,excel 中的单元格显示警告为 Number Stored as Text。因此无法进行任何操作。
这是我的代码
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);
如何消除这个错误。
将以下行添加到您的代码中:
<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()))