ireport 导出word 文档,文字全是乱码,求解
代码配置如下:
JRDataSource dataSource = new JRBeanCollectionDataSource(“数据源”);
File reportFile = new File(“模板路径”);
InputStream inputStream = new FileInputStream(reportFile);
JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, headMap, dataSource);
PrintObjectList.add(jasperPrint);
response.setContentType("application/msword;charset=utf-8");
response.setHeader("Content-Disposition","attachment;filename="+new String(downName.getBytes("gb2312"), "iso-8859-1"));
exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, PrintObjectList);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outputStream);
exporter.exportReport();
代码配置如下:
JRDataSource dataSource = new JRBeanCollectionDataSource(“数据源”);
File reportFile = new File(“模板路径”);
InputStream inputStream = new FileInputStream(reportFile);
JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, headMap, dataSource);
PrintObjectList.add(jasperPrint);
response.setContentType("application/msword;charset=utf-8");
response.setHeader("Content-Disposition","attachment;filename="+new String(downName.getBytes("gb2312"), "iso-8859-1"));
exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, PrintObjectList);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outputStream);
exporter.exportReport();