我想将报告导出为 html 格式,并使用SimpleHtmlReportConfiguration
设置一些配置。 exporter.setConfiguration(reportConfig)
无法正常工作。我不知道。
我的旧代码:
HtmlExporter exporter = new HtmlExporter();
// output file for generated html report
File file = new File(outputFileName);
// setting some sonfigs for the report
exporter.setExporterInput(new SimpleExporterInput(filedReport));
SimpleHtmlExporterOutput exporterOutput = new SimpleHtmlExporterOutput(file);
// the folder for storing images. It will be subfolder with name starting like generated html and ended with postfix "_files"
File resourcesDir = new File(file.getParent(), file.getName() + "_files");
// argument ({0}) will be replaced with the real image name
String imageURI = "qip?srvAction=ReportImage&img="+returnFileName.substring(3).replace("/", "%2F")+"_files"+"%2F" + "{0}";
exporterOutput.setImageHandler(new FileHtmlResourceHandler(resourcesDir, imageURI));
exporter.setExporterOutput(exporterOutput);
SimpleHtmlExporterConfiguration exporterConfig = new SimpleHtmlExporterConfiguration();
exporterConfig.setBetweenPagesHtml("");
exporter.setConfiguration(exporterConfig);
SimpleHtmlReportConfiguration reportConfig = new SimpleHtmlReportConfiguration();
reportConfig.setRemoveEmptySpaceBetweenRows(true);
exporter.setConfiguration(reportConfig);