Browse Source

以UTF-8编码方式读取jrxml字符串为字节流

sunyj 8 năm trước cách đây
mục cha
commit
e0933f0260

+ 2 - 1
src/main/java/com/uas/report/service/impl/PrintServiceImpl.java

@@ -190,7 +190,8 @@ public class PrintServiceImpl implements PrintService {
 
 				} else if (exportFileType.equals(ReportConstants.FILE_TYPE_WORD)) {
 					// 导出word时需要对行距等进行调整
-					InputStream inputStream = new ByteArrayInputStream(modifyLineSpacing(jrxmlFilePath).getBytes());
+					InputStream inputStream = new ByteArrayInputStream(
+							modifyLineSpacing(jrxmlFilePath).getBytes("UTF-8"));
 					JasperReport jasperReport = JasperCompileManager.compileReport(inputStream);
 					jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, connection);
 					inputStream.close();