1. 程式人生 > >使用Aspose.cells實現Excel轉換為pdf

使用Aspose.cells實現Excel轉換為pdf

import java.io.FileInputStream;
import java.io.InputStream;


import com.aspose.cells.License;
import com.aspose.cells.SaveFormat;
import com.aspose.cells.Workbook;


public class CellsConverter {


public CellsConverter() throws Exception {
License license = new License();
InputStream open = CellsConverter.class.getResource("license.xml").openStream();
license.setLicense(open);
open.close();
}


public void getConverter(String oldPath, String savePath) throws Exception {
Workbook book = new Workbook(new FileInputStream(oldPath));
book.save(savePath, SaveFormat.PDF);
}


}