使用C++的Node.js计算数据表数组公式

Contents
[ ]

在以下示例代码中,我们使用了source excel file。如果您将单元格B1的值更改为100,则填充为黄色的数据表的值将变为120,如下图所示。 示例代码生成了output PDF

todo:image_alt_text

todo:image_alt_text

以下是用于从source excel file生成output PDF的示例代码。 请阅读注释以获取更多信息。

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

// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Create workbook from source excel file
const workbook = new AsposeCells.Workbook(path.join(dataDir, "DataTable.xlsx"));

// Access first worksheet
const worksheet = workbook.getWorksheets().get(0);

// When you will put 100 in B1, then all Data Table values formatted as Yellow will become 120
worksheet.getCells().get("B1").putValue(100);

// Calculate formula, now it also calculates Data Table array formula
workbook.calculateFormula();

// Save the workbook in pdf format
workbook.save(path.join(dataDir, "output_out.pdf"));