发新话题
移动帖子 加入精华 加入置顶 加入收藏 关注此帖

reoprt 报表在html中显示的问题,困扰好多天了,求大家帮帮忙!!!



reoprt 报表在html中显示的问题,困扰好多天了,求大家帮帮忙!!!

很奇怪,做好的报表只有test.jasper一个可以正常在html和pdf中显示,其他的都显示为空白,已经设置了中文编码,
Font name:宋体 (中文字体)
PDF font name: STSong-Light
PDF Encoding: UniGB-UCS2-H(Chinese Siplified)
PDF Embeded: √
可还是空白,还有什么可能?有谁出现过这种情况么?谢谢大家啦!
下面代码,没有报错:
<%
File reportFile = new File(application.getRealPath("report/test.jasper"));
System.out.println(reportFile);

JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath());

Map parameters = new HashMap();
parameters.put("images_paths",request.getRealPath("/report/img/")+"\\");
parameters.put("url1","1.jpg");
parameters.put("url2","2.jpg");
parameters.put("url3","3.jpg");
parameters.put("test","test11111111111111111");

response.setContentType("text/html;charset=utf-8");

JasperReport report=(JasperReport)JRLoader.loadObject(reportFile.getAbsolutePath());
JRHtmlExporter exporter=null;

exporter = new JRHtmlExporter();

String url="jdbc:mysql://localhost:3306/report?user=root&password=****";
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn=DriverManager.getConnection(url);

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn);

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "./report/img/");
exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME,request.getRealPath("/report/img")+"\\");
exporter.setParameter(JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR,Boolean.TRUE);
exporter.setParameter(JRHtmlExporterParameter.SIZE_UNIT,"pt");

out.flush();
conn.close();

%>
编辑 回复 快速回复 TOP

Re:reoprt 报表在html中显示的问题,困扰好多天了,求大家帮帮忙!!!

原来我也碰过这问题,不过还是也没解决,因为是接别人项目,他用的版本比较低,我本地能显示,但是上传的服务器上就不行,你看看是不是环境的问题

后来我用1.25以后 好像这种问题没有了
编辑 回复 快速回复 TOP
发新话题