ワークシートのすべての列を単一の PDF ページに収める

ワークシートの列を単一の PDF ページに収める

PdfSaveOptions.all_columns_in_one_page_per_sheetは、ワークシート内のすべての列が1つのPDFページにレンダリングされることを保証します。ただし、ワークシートのデータに応じて、行が複数のページに拡張される場合があります。

以下のサンプルコードは、100列の大きなワークシートをレンダリングするためにPdfSaveOptions.all_columns_in_one_page_per_sheetプロパティを使用する方法を示しています。

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)