[测评系统]--测评系统核心代码库
linzhijie
2021-08-06 17ac23e93792f1403297dfa783c85db0c10abb20
src/main/java/com/ots/project/tool/ShellTool.java
@@ -10,8 +10,8 @@
        StringBuilder builder = new StringBuilder();
        if (os.toLowerCase().startsWith("mac")) {
            builder.append("/Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to ");
        }  else if(os.toLowerCase().startsWith("windows")){
            builder.append("soffice.exe --headless --invisible --convert-to ");
        } else if(os.contains("Windows")){
            builder.append("cmd /c start soffice --headless --convert-to ");
        } else {
            builder.append("libreoffice6.4 --headless --convert-to ");
        }
@@ -28,6 +28,7 @@
        }
        return exec(builder.toString());
    }
    private static String exec(String command) {
        String returnString = "";
        Runtime runTime = Runtime.getRuntime();
@@ -51,6 +52,6 @@
        return returnString;
    }
    public static void main(String[] args) {
        System.out.println(exec("soffice.exe --headless --invisible --convert-to  D:/ots/uploadPath/upload/2021/02/28/01e01cf7e372ba8b1c5d24b8d69a46f8.docx 01e01cf7e372ba8b1c5d24b8d69a46f8.pdf "));
        //System.out.println(exec("soffice.exe --headless --invisible --convert-to  D:/ots/uploadPath/upload/2021/02/28/01e01cf7e372ba8b1c5d24b8d69a46f8.docx 01e01cf7e372ba8b1c5d24b8d69a46f8.pdf "));
    }
}