当前位置:网站首页>Use aspese Cells convert Excel to PDF

Use aspese Cells convert Excel to PDF

2022-06-27 09:34:00 Sparkle_ wsl

Use Aspose.cells take Excel Turn into PDF

Source document address

https://blog.csdn.net/dxyzhbb/article/details/90408092

download jar package

 link :https://pan.baidu.com/s/1QbhZ-6qmG1N-n6BoF3yZTQ 
 Extraction code :npdy 

Add to your own mvn Warehouse

mvn install:install-file -Dfile="jar Bag location " -DgroupId="groupId" -DartifactId="artifactId" -Dversion=" edition " -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true

Guide pack

<!-- take excel Turn into pdf( Own packaging method )-->
        <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose-cells</artifactId>
            <version>8.5.2</version>
        </dependency>

Code

@Test
    public void excelToPdf() throws Exception {
    
        // Remove watermark 
        String licenseXml = "<License><Data><Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products><EditionType>Enterprise</EditionType><SubscriptionExpiry>20991231</SubscriptionExpiry><LicenseExpiry>20991231</LicenseExpiry><SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber></Data><Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature></License>";
        ByteArrayInputStream is = new ByteArrayInputStream(licenseXml.getBytes());
        com.aspose.cells.License license = new com.aspose.cel` Insert a code chip here `ls.License();
        license.setLicense(is);
        // establish Workbook object 
        Workbook workbook = new Workbook("C:\\Users\\wucn\\Desktop\\work\\OA\\ test .xls");
        // Save as pdf
        workbook.save("C:\\Users\\wucn\\Desktop\\work\\OA\\ test .xls.pdf", com.aspose.cells.SaveFormat.PDF);

    }
原网站

版权声明
本文为[Sparkle_ wsl]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/178/202206270924081389.html