Эх сурвалжийг харах

replace '宋体001' with '宋体'

sunyj 8 жил өмнө
parent
commit
e5a1ef352c

+ 4 - 0
report/src/main/java/com/uas/report/service/impl/PrintServiceImpl.java

@@ -380,7 +380,11 @@ public class PrintServiceImpl implements PrintService {
 	private void replaceFont(String jrxmlFilePath) throws FileNotFoundException, IOException {
 		File jrxmlFile = new File(jrxmlFilePath);
 		String xml = FileUtils.readAsString(jrxmlFile);
+		if(StringUtils.isEmpty(xml)){
+		    throw new IllegalStateException("报表模版内容为空");
+        }
 		xml = xml.replace("MSYahei", ReportConstants.MICROSOFT_YAHEI_UI_FONT_NAME);
+        xml = xml.replace("宋体001", ReportConstants.SIMSUN_UI_FONT_NAME);
 		FileUtils.write(jrxmlFile, xml);
 	}
 

+ 4 - 0
report/src/main/java/com/uas/report/util/ReportConstants.java

@@ -23,4 +23,8 @@ public class ReportConstants {
 	 */
 	public static final String MICROSOFT_YAHEI_UI_FONT_NAME = "Microsoft YaHei UI";
 
+    /**
+     * 宋体字体名称
+     */
+    public static final String SIMSUN_UI_FONT_NAME = "宋体";
 }