1、导入jar包
aspose-words-15.8.0-jdk16.jar(word的jar包)、aspose-cells.jar(excel的jar包)
license.xml 文件放在src下
2、excel转pdf代码
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import com.aspose.cells.License;
import com.aspose.cells.PdfSaveOptions;
import com.aspose.cells.SaveFormat;
import com.aspose.cells.Workbook;
public class ExcelToPdf {
public static boolean getLicense() {
boolean result = false;
try {
InputStream is = ExcelToPdf.class.getClassLoader().getResourceAsStream("license.xml"); // license.xml应放在..\WebRoot\WEB-INF\classes路径下
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
}catch (Exception e) {
e.printStackTrace();
}
r