Json 通过 Node.js 与 C++ 实现

将Excel工作簿转换为JSON

Aspose.Cells API 提供了将电子表格转换为 JSON 格式的支持。要导出工作簿到 JSON,请将 SaveFormat.Json 作为 Workbook.save(string, SaveFormat) 方法的第二个参数传递。你还可以使用 JsonSaveOptions 类来指定导出工作表到 JSON 的其他设置。

以下代码示例演示如何使用 SaveFormat.Json 枚举成员将活动工作表导出为 JSON。请参阅代码,将 source file 转换为 输出 JSON 文件。以作参考。

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

// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "Book1.xlsx");

// Load your source workbook
const workbook = new AsposeCells.Workbook(filePath);

// Convert the workbook to json file.
workbook.save(path.join(dataDir, "book1.json"));

高级主题