将所有工作表列放在单个页面上 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);