日期:2014-05-18  浏览次数:20739 次

ireoprt 报表在html中显示的问题,困扰好多天了,求大家帮帮忙!!!
很奇怪,做好的报表只有test.jasper可以正常在html中显示,其他的都显示为空白,已经设置了中文编码, 
  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();

  %>

------解决方案--------------------
挑几处打印下 怎会空白?