youseries / ureport

UReport2 is a high-performance pure Java report engine based on Spring architecture, where complex Chinese-style statements and reports can be prepared by iterating over cells.
Apache License 2.0
2.05k stars 837 forks source link

图表保存xml格式,用exportHtml渲染页面失败 #549

Open dayinyin opened 3 years ago

dayinyin commented 3 years ago

用exportHtml渲染表格可以,但是渲染图表不行

具体代码

@RequestMapping(value = "/test") public String toHtml(HttpServletRequest request) { ExportManager exportManager=(ExportManager)Utils.getApplicationContext().getBean(ExportManager.BEAN_ID); Map<String,Object> parameters=new HashMap<String,Object>();

    HtmlReport htmlReport = exportManager.exportHtml("file:test.ureport.xml",request.getContextPath(),parameters);
    //输出Css样式
    StringBuilder sb = new StringBuilder();
    sb.append("<style type=\"text/css\">").append(htmlReport.getStyle()).append("</style>").append(htmlReport.getContent());
    return sb.toString();
}

xml是保存表格格式的信息,图表缺反推渲染失败。