每个 Excel 工作表渲染一个 PDF 页 - Excel 到 PDF 的转换

Contents
[ ]

请参阅以下将包含多个工作表的 Excel 文件转换为 PDF 的示例代码。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(ExceltoPDF.class);
// Initialize a new Workbook
// Open an Excel file
Workbook workbook = new Workbook(dataDir + "Mybook.xls");
// Implement one page per worksheet option
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setOnePagePerSheet(true);
// Save the PDF file
workbook.save(dataDir + "OutputFile.pdf", pdfSaveOptions);