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

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

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

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

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create and initialize an instance of Workbook
Workbook book = new Workbook(dataDir + "TestBook.xlsx");
// Create and initialize an instance of PdfSaveOptions
PdfSaveOptions saveOptions = new PdfSaveOptions();
// Set AllColumnsInOnePagePerSheet to true
saveOptions.AllColumnsInOnePagePerSheet = true;
// Save Workbook to PDF fromart by passing the object of PdfSaveOptions
dataDir = dataDir+ "output.out.pdf";
book.Save(dataDir, saveOptions);