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

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

PdfSaveOptions.setAllColumnsInOnePagePerSheet は、ワークシートのすべての列が単一の PDF ページにレンダリングされることを確実にします。ただし、ワークシートのデータに応じて複数のページにまたがることがあります。

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

// 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(FitAllWorksheetColumns.class);
// 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(SaveFormat.PDF);
// Set AllColumnsInOnePagePerSheet to true
saveOptions.setAllColumnsInOnePagePerSheet(true);
// Save Workbook to PDF fromart by passing the object of PdfSaveOptions
book.save(dataDir + "output.pdf", saveOptions);