将Excel工作表渲染为一份PDF页面 Excel转PDF转换

Contents
[ ]

请查看以下示例代码,将多个工作表的Excel文件转换为PDF。

from aspose.cells import PdfSaveOptions, Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
# Initialize a new Workbook
# Open an Excel file
workbook = Workbook(dataDir + "input.xlsx")
# Implement one page per worksheet option
pdfSaveOptions = PdfSaveOptions()
pdfSaveOptions.one_page_per_sheet = True
# Save the PDF file
workbook.save(dataDir + "OutputFile.out.pdf", pdfSaveOptions)