[测评系统]--测评系统核心代码库
林致杰
2023-10-19 77f6cf1868777a27c033af7d6d4f2fe9d2afc30d
src/main/java/com/ots/common/utils/poi/WordUtil.java
@@ -24,6 +24,7 @@
import org.apache.commons.collections.map.HashedMap;
import org.apache.poi.ooxml.POIXMLDocument;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.util.ZipSecureFile;
import org.apache.poi.util.Units;
import org.apache.poi.xwpf.usermodel.*;
import org.apache.xmlbeans.XmlCursor;
@@ -1179,10 +1180,12 @@
                changColorIfJAQ(textMap, out, reportName, tReportTemplate.getReportType());
            //}
            //PAQ、MAQTR采用新的doc转pdf
            //PAQ、MAQTR采用、CIAQ新的doc转pdf
            if(ReportTypeEnum.PAQ.getCode().equals(reportType) || ReportTypeEnum.MAQTR.getCode().equals(reportType)
                    || ReportTypeEnum.CIAQ.getCode().equals(reportType)){
                PdfUtil.convertPDF(EssConfig.getProfile() + "/" + reportName);
            }else if(ReportTypeEnum.LAQ.getCode().equals(reportType)){
                PdfUtil.convertPythonPDF(EssConfig.getDocx2pdf(),EssConfig.getProfile() + "/" + reportName);
            }else{
                ShellTool.execLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/");
                // ShellTool shellTool = ShellTool.builder();
@@ -1282,6 +1285,7 @@
     */
    private static void setChageWord(String fileName, OutputStream out, Map<String, Object> textMap, String reportType,String dataPath, Map<Integer, Map<Integer, List<String[]>>> autoTableMap) throws IOException, InvalidFormatException, DocumentException {
        //String filePath = getTemplateDownLoadPathByUpLoad(fileName);
        ZipSecureFile.setMinInflateRatio(0.001);
        XWPFDocument document = new XWPFDocument(POIXMLDocument.openPackage(getTemplateDownLoadPathByUpLoad(fileName)));