Java 从以Excel格式生成的JasperReports报告中删除软件信息

Java 从以Excel格式生成的JasperReports报告中删除软件信息,java,jasper-reports,metadata,export-to-excel,Java,Jasper Reports,Metadata,Export To Excel,我正在使用JasperReports创建XLS报告,代码为: JRXlsExporter exporter = new JRXlsExporter(); exporter.setExporterInput(new SimpleExporterInput(compile(report))); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(stream)); SimpleXlsReportConfiguration

我正在使用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();
        }           
    };

实现如下
SimpleXlsReportConfiguration=newsimplexlsreportconfiguration();SimpleXLMetadataExporterConfiguration exporterConfiguration=新SimpleXLMetadataExporterConfiguration();exporterConfiguration.setMetadataApplication(“”);配置。setOnePagePerSheet(真);configuration.setWhitePageBackground(FALSE);configuration.isRemoveEmptySpaceBetweenRows();exporter.setConfiguration(配置);exporter.setConfiguration(exporterConfiguration)