package com.demo;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import com.aspose.cells.License;
import com.aspose.cells.SaveFormat;
import com.aspose.cells.Workbook;
/**
*
* 由于ASPOSE比较吃内存,操作大一点的文件就会堆溢出,所以请先设置好java虚拟机参数:-Xms512m -Xmx512m(参考值)<br>
*
* 如有疑问,请在CSDN下载界面留言, 或者联系QQ569925980<br>
*
* @author Spark
*
*/
public class TestCells {
private static InputStream license;
private static InputStream cells;
/**
* 获取license
*
* @return
*/
public static boolean getLicense() {
boolean result = false;
try {
license = TestCells.class.getClassLoader().getResourceAsStream("\\license.xml"); // license路径
cells = TestCells.class.getClassLoader().getResourceAsStream("\\test.xlsx"); // 原始excel路径
License aposeLic = new License();
aposeLic.setLicense(license);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
*
* @param args
*/
public static void main(String[] args) {
// 验证License
if (!getLicense()) {
return;
}
try {
long old = System.currentTimeMillis();
Workbook wb = new Workbook(cells);
File file = new File("D:\\test.pdf");// 输出路径
FileOutputStream fileOS = new FileOutputStream(file);
wb.save(fileOS, SaveFormat.PDF);
long now = System.currentTimeMillis();
System.out.println("共耗时:" + ((now - old) / 1000.0) + "秒\n\n" + "文件保存在:" + file.getPath());
} catch (Exception e) {
e.printStackTrace();
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
aspose cells for java 8.6.1最新完美破解版,无水印无文件大小限制,无使用时间限制。如果亲们在使用过程中有任何问题,请在楼下回复即可。本人亲自破解,内含Eclipse工程,直接导入Eclipse就能运行demo。适用于jdk6.0的环境,免费下载!警告:请勿用于商业用途,仅供学习研究,如有任何版权纠纷,本人概不负责!
资源推荐
资源详情
资源评论
收起资源包目录
AsposeCells.zip (10个子文件)
AsposeCells
bin
license.xml 584B
com
demo
test.xlsx 178KB
.settings
org.eclipse.core.resources.prefs 57B
org.eclipse.jdt.core.prefs 598B
src
license.xml 584B
com
demo
TestCells.java 2KB
test.xlsx 178KB
.project 387B
.classpath 366B
lib
aspose-cells-8.6.1.jar 5.81MB
共 10 条
- 1
资源评论
- 94树上的男爵2017-10-15还是有水印
- plkkoko2018-02-09就是要这样的好东西!
Spark丶
- 粉丝: 238
- 资源: 67
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功