java - 从 Excel 格式的 JasperReports 报告中删除软件信息
问题描述
我正在使用 JasperReports 和代码创建一个 XLS 报告:
JRXlsExporter exporter = new JRXlsExporter();
exporter.setExporterInput(new SimpleExporterInput(compile(report)));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(stream));
SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
configuration.setOnePagePerSheet(TRUE);
exporter.setConfiguration(configuration);
exporter.exportReport();
我需要从 xls 文件元数据中删除软件信息
运行exiftool Vinculaciones.xls
命令的结果:
ExifTool Version Number : 12.00
File Name : Vinculaciones.xls
Directory : .
File Size : 5.5 kB
File Modification Date/Time : 2020:06:11 15:53:33-05:00
File Access Date/Time : 2020:06:11 15:53:33-05:00
File Creation Date/Time : 2020:06:11 15:53:32-05:00
File Permissions : rw-rw-rw-
File Type : XLS
File Type Extension : xls
MIME Type : application/vnd.ms-excel
Software : JasperReports Library version 6.12.2-75c5e90a222ab406e416cbf590a5397028a52de3
Warning : Truncated property list
解决方案
尝试添加这些行:
SimpleXlsExporterConfiguration exportConfig = new SimpleXlsExporterConfiguration();
exportConfig.setMetadataApplication("");
exporter.setConfiguration(exportConfig);
这不会删除软件元数据字段,但会为其放置一个空值。如果要完全删除该字段,则必须更改/扩展导出器代码,例如:
JRXlsExporter exporter = new JRXlsExporter() {
@Override
protected void openWorkbook(OutputStream os) {
super.openWorkbook(os);
workbook.getSummaryInformation().removeApplicationName();
}
};
推荐阅读
- google-cloud-platform - 数据流 - 错误:消息:需要“compute.subnetworks.get”权限
- python - 如何保存另一个文件中存在的关键字?
- java - 如何知道在运行时使用了接口 EntityManager 的哪个确切实现?
- c# - ORA-03137: 来自客户端的格式错误的 TTC 数据包被拒绝
- php - 阵列的定位
- php - 如何确定 php 中 PNG 图像的“每行字节数”?
- image-processing - scikit 图像(skimage)在梯度计算中排除白色背景
- python - 如何等到表格加载到网页上
- react-native - 无法使用 npm pack 生成的包解析类
- arm - PUSH 和 POP 括号中的寄存器排序