将所有工作表列调整到单个PDF页面

使工作表列适合单个PDF页面

PdfSaveOptions.AllColumnsInOnePagePerSheet确保工作表中的所有列都呈现在单个PDF页面上,尽管根据工作表中的数据,行可能会扩展到几页。

下面的示例代码显示了如何使用PdfSaveOptions.AllColumnsInOnePagePerSheet属性呈现一个包含100列的大型工作表。

// 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);