将所有工作表列调整到单个PDF页面

使工作表列适合单个PDF页面

PdfSaveOptions.all_columns_in_one_page_per_sheet确保工作表中的所有列都呈现在单个PDF页面上,尽管根据工作表中的数据,行可能会扩展到几页。

下面的示例代码显示了如何使用PdfSaveOptions.all_columns_in_one_page_per_sheet属性呈现一个包含100列的大型工作表。

from aspose.cells import PdfSaveOptions, SaveFormat, 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(".")
# Create and initialize an instance of Workbook
book = Workbook(dataDir + "TestBook.xlsx")
# Create and initialize an instance of PdfSaveOptions
saveOptions = PdfSaveOptions(SaveFormat.PDF)
# Set AllColumnsInOnePagePerSheet to true
saveOptions.all_columns_in_one_page_per_sheet = True
# Save Workbook to PDF fromart by passing the object of PdfSaveOptions
dataDir = dataDir + "output.out.pdf"
book.save(dataDir, saveOptions)