日期:2014-05-17 浏览次数:20871 次
public static void doPrint(String orderNumber) throws Exception {
Map<String, Object> param=new HashMap<String, Object>();
param.put("orderNumber", orderNumber);
JasperDesign jasperDesign = JRXmlLoader
.load("D:\\book.jrxml");
JasperReport jasperReport = JasperCompileManager
.compileReport(jasperDesign);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
param, getConn());
JasperFillManager.fillReport(jasperReport, param);
JasperViewer.viewReport(jasperPrint, false);
JRXlsExporter exporter = new JRXlsExporter();
getConn().close();
}