ワークシートのすべての列を単一の 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);