使用Node.js通过C++将所有工作表列适配到单一PDF页面

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

PdfSaveOptions.getAllColumnsInOnePagePerSheet()确保工作表中的所有列都呈现在单一PDF页面上,尽管行可能会根据工作表中的数据展开至多多页。

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

const path = require("path");
const AsposeCells = require("aspose.cells.node");

// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Create and initialize an instance of Workbook
const workbook = new AsposeCells.Workbook(path.join(dataDir, "TestBook.xlsx"));
// Create and initialize an instance of PdfSaveOptions
const saveOptions = new AsposeCells.PdfSaveOptions();
// Set AllColumnsInOnePagePerSheet to true
saveOptions.setAllColumnsInOnePagePerSheet(true);
// Save Workbook to PDF format by passing the object of PdfSaveOptions
const outputFilePath = path.join(dataDir, "output.out.pdf");
workbook.save(outputFilePath, saveOptions);