当前位置:网站首页>使用Aspose.cells将Excel转成PDF
使用Aspose.cells将Excel转成PDF
2022-06-27 09:24:00 【Sparkle_wsl】
使用Aspose.cells将Excel转成PDF
源文档地址
https://blog.csdn.net/dxyzhbb/article/details/90408092
下载jar包
链接:https://pan.baidu.com/s/1QbhZ-6qmG1N-n6BoF3yZTQ
提取码:npdy
添加到自己的mvn仓库
mvn install:install-file -Dfile="jar包位置" -DgroupId="groupId" -DartifactId="artifactId" -Dversion="版本" -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
导包
<!--将excel转成pdf(自己的打包方式)-->
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cells</artifactId>
<version>8.5.2</version>
</dependency>
代码
@Test
public void excelToPdf() throws Exception {
//去除水印
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`在这里插入代码片`ls.License();
license.setLicense(is);
//创建Workbook对象
Workbook workbook = new Workbook("C:\\Users\\wucn\\Desktop\\work\\OA\\测试.xls");
//保存成pdf
workbook.save("C:\\Users\\wucn\\Desktop\\work\\OA\\测试.xls.pdf", com.aspose.cells.SaveFormat.PDF);
}
边栏推荐
- ucore lab4
- 经典的一道面试题,涵盖4个热点知识
- Matlab tips (18) matrix analysis -- entropy weight method
- 2022.6.26-----leetcode. seven hundred and ten
- i=i++;
- 支付宝微信支付业务流程图
- VIM from dislike to dependence (20) -- global command
- 最全H桥电机驱动模块L298N原理及应用
- MySQL proficient-01 addition, deletion and modification
- 数字IC-1.9 吃透通信协议中状态机的代码编写套路
猜你喜欢
One week's experience of using Obsidian (configuration, theme and plug-in)
Enumeration? Constructor? Interview demo
orthofinder直系同源蛋白分析及结果处理
Source insight 工具安装及使用方法
[vivid understanding] the meanings of various evaluation indicators commonly used in deep learning TP, FP, TN, FN, IOU and accuracy
Advanced mathematics Chapter 7 differential equations
win10为任意文件添加右键菜单
Take you to play with the camera module
C# 解决使用SQLite 的相对路径问题
Some exercises about binary tree
随机推荐
HiTek电源维修X光机高压发生器维修XR150-603-02
[cloud native] 2.3 kubernetes core practice (Part 1)
Matlab tips (19) matrix analysis -- principal component analysis
Advanced mathematics Chapter 7 differential equations
How Oracle converts strings to multiple lines
i=i++;
微信小程序学习之五种页面跳转方法.
数字IC-1.9 吃透通信协议中状态机的代码编写套路
RMAN-08137 主库无法删除归档文件
Source insight 工具安装及使用方法
我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!
Analysis log log
Installation and use of SVN version controller
Take you to play with the camera module
ucore lab5
Collection framework generic LinkedList TreeSet
快速入门CherryPy(1)
VIM from dislike to dependence (20) -- global command
Demand visual Engineer
I'm almost addicted to it. I can't sleep! Let a bug fuck me twice!