package cn.com.sparknet.index.controller;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import com.aspose.cells.Workbook;
import com.aspose.words.Document;
import com.aspose.words.SaveFormat;
public class Demo {
public static void main(String[] args) {
excel2pdf("/home/yangli@sparknet.com.cn/upload/在用软件调查.xlsx","/home/yangli@sparknet.com.cn/upload/在用软件调查.pdf");
}
public static void excel2pdf(String excelPath, String pdfPath) {
try {
Workbook wb = new Workbook(excelPath);// 原始excel路径
FileOutputStream fileOS = new FileOutputStream(new File(pdfPath));
wb.save(fileOS, com.aspose.cells.SaveFormat.PDF);
fileOS.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
参考路径excel转pdf路径:https://www.cnblogs.com/zhaosq/p/9796255.html
excel转pdf需要引入aspose-cells-8.5.2.jar
Excel
http://note.youdao.com/noteshare?id=f75d87445106ea6ca6b54cfa58bc4fb2