jasper 不格式化 Excel 数据类型
我有一个 Jasper 报告,它似乎可以很好地导出除 Excel 之外的所有格式。
下面的示例是应将其格式设置为货币但显示不正确的列。
这是我正在使用的 jasper 属性...
out = new FileOutputStream(file);
JExcelApiExporter exporterXLS = new JExcelApiExporter();
exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, print);
exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.CREATE_CUSTOM_PALETTE, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN, Boolean.FALSE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_IGNORE_CELL_BORDER, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_IGNORE_GRAPHICS, Boolean.FALSE);
exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, out);
exporterXLS.exportReport();
我已经尝试过 Jasper 4.0 和 4.5。我认为这与依赖性有关,但我不确定。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试为您的
textField
元素添加net.sf.jasperreports.export.xls.pattern
属性jrxml 文件。您可以在此处找到示例。
You can try to add
net.sf.jasperreports.export.xls.pattern
property for yourtextField
element in jrxml file.You can find the sample here.
固定的!
我没有使用 JRXlsExporterParameter 类,而是使用了如下参数,并且它有效!
fixed!
Instead of using the
JRXlsExporterParameter
class i used the parameters as follows and it worked!