From 1f35c75edfde8d204e788f304929b1fb01ddb765 Mon Sep 17 00:00:00 2001 From: zhijie <1003392067@qq.com> Date: 星期日, 08 八月 2021 21:13:35 +0800 Subject: [PATCH] 1.PAQ简易版(中英泰)支持 2.支持完美水滴生成 --- src/main/java/com/ots/common/utils/poi/WordUtil.java | 58 ++++++++++++++++++++++------------------------------------ 1 files changed, 22 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/ots/common/utils/poi/WordUtil.java b/src/main/java/com/ots/common/utils/poi/WordUtil.java index 029f035..2f7182f 100644 --- a/src/main/java/com/ots/common/utils/poi/WordUtil.java +++ b/src/main/java/com/ots/common/utils/poi/WordUtil.java @@ -9,6 +9,7 @@ import com.ots.project.exam.domain.TReportTemplate; import com.ots.project.exam.dto.JAQTableStyle; import com.ots.project.exam.dto.WordParam; +import com.ots.project.tool.PdfUtil; import com.ots.project.tool.ShellTool; import com.ots.project.tool.exam.ExamUtil; import com.ots.project.tool.exam.ImageUtil; @@ -17,6 +18,7 @@ import com.ots.project.tool.report.JAQ.condition.Table2; import com.ots.project.tool.report.JAQ.condition.Table3; import com.ots.project.tool.report.JAQ.condition.Table4; +import com.ots.project.tool.report.PAQ.chart.PAQChart; import com.ots.project.tool.report.SAQ.chart.SAQChart; import org.apache.commons.collections.map.HashedMap; import org.apache.poi.ooxml.POIXMLDocument; @@ -432,9 +434,25 @@ public static boolean checkText(String text) { //鏇挎崲鏂囨湰鍖呭惈% if (text.indexOf("%") != -1 || StringUtils.equals(text, "N/A NONE")) { - return true; + //鍙湁%澶т簬1 鎵嶉�氳繃 + if(getCount(text) > 1){ + return true; + } + return false; } return false; + } + + //鍒ゆ柇%鍑虹幇鐨勬鏁� + public static int getCount(String text){ + //鏃ч暱搴� + int oldLength = text.length(); + text = text.replace("%", ""); + //鏂伴暱搴� + int newLength = text.length(); + //鍑虹幇娆℃暟 = 鏃ч暱搴� - 鏂伴暱搴� + int count = oldLength - newLength; + return count; } public static String changeValue(String runValue, Map<String, Object> textMap, XWPFRun run, XWPFParagraph paragraph, XWPFDocument document, int runPosition) throws IOException, org.apache.poi.openxml4j.exceptions.InvalidFormatException { @@ -606,38 +624,6 @@ } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - private static void changOtherPicture(XWPFParagraph paragraph) { String paragraphText = paragraph.getText(); @@ -771,7 +757,7 @@ if(!ReportTypeEnum.PAQ.getCode().equals(reportType)){ ShellTool.execLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/"); }else{ - ShellTool.execPythonCommand(1,EssConfig.getProfile() + "/" + reportName); + PdfUtil.convertPDF(EssConfig.getProfile() + "/" + reportName); } zipFilePath = getPdfPath(reportName); @@ -862,8 +848,8 @@ changeTextBox(document, textMap); //璁剧疆鍥捐〃 - if (Objects.equals(reportType, ReportTypeEnum.SAQ.getCode()) || Objects.equals(reportType, ReportTypeEnum.PAQ.getCode())) { - SAQChart.changeChart(document, textMap); + if (Objects.equals(reportType, ReportTypeEnum.PAQ.getCode())) { + PAQChart.changeChart(document, textMap); } //鎻掑叆琛ㄦ牸 -- Gitblit v1.9.1