【aspose之二】【springboot】java使用aspose.html 的cloud版html转docx,word

前言

一、html转word

一)代码实现

1.maven配置

    <dependency>
      <groupId>com.aspose</groupId>
      <artifactId>aspose-html-cloud</artifactId>
      <version>22.12.1</version>

    </dependency>

2.代码

本地文件 html转docx

    public static void html2word(){
        Configuration.setBasePath("https://api.aspose.cloud");

        Configuration.setAuthPath("https://api.aspose.cloud/connect/token");


        HtmlApi api = new HtmlApi("你的密钥","你的clientId");
        String inputFile = "D:\\html\\word1.html";
        String outputFile = "./word1.docx";
        String inputURL = "https://xxxx";
        
        JobBuilder builder = new ConverterBuilder()
                .fromLocalFile(inputFile)
                .saveToLocal(outputFile);

        OperationResult result = api.convert(builder);
        System.out.println("result = " + result);


    }

2.密钥及配置
aspose配置

你可能感兴趣的:(文档处理,Java,java,spring,boot,html)