我正在尝试将带有图表和网格的报表转换为html并将其渲染为iframe,但它会在没有图表的情况下呈现。在我的控制器中,我没有使用HtmlReportUtil.createStreamHTML
(从其他帖子中学习)。
我尝试使用HtmlReportUtil.createDirectoryHTML()
,但我仍然无法获得图表或图片。它使用网格创建纯HTML,但缺少图表和图像。我还尝试编写自定义HTML打印机,并尝试了here中的这段代码。
final StreamRepository targetRepository = new StreamRepository(response.getOutputStream());
final ContentLocation targetRoot = targetRepository.getRoot();
final HtmlOutputProcessor outputProcessor = new StreamHtmlOutputProcessor(report.getConfiguration());
final HtmlPrinter printer = new ReportHtmlPrinter(report.getResourceManager());
printer.setContentWriter(targetRoot, new DefaultNameGenerator(targetRoot, "index", "html"));
printer.setDataWriter(null,null);
printer.setUrlRewriter(rewriter);
outputProcessor.setPrinter(printer);
final StreamReportProcessor sp = new StreamReportProcessor(report, outputProcessor);
sp.processReport();
sp.close();
请帮我弄清楚如何在Spring MVC Web应用程序中使用图表。提前谢谢。