将 Excel 转换为 JSON

将 Excel 工作簿转换为 JSON

无需考虑如何将 Excel 工作簿转换为 JSON,因为 Apose.Cells for .NET 库有最佳决策。 Aspose.Cells API 提供将电子表格转换为 JSON 格式的支持。要将工作簿导出到 JSON,请通过保存格式.Json作为第二个参数工作簿.保存方法。您也可以使用JsonSave选项类以指定将工作表导出到 JSON 的其他设置。

以下代码示例演示了将 Excel 工作簿导出到 Json。请看代码转换源文件给代码生成的Json文件供参考。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Load your source workbook
Workbook workbook = new Workbook("sample.xlsx");
//Convert the workbook to json file.
workbook.Save("sample_out.json");

以下代码示例使用 JsonSaveOptions 类指定其他设置,演示了将 Excel 工作簿导出到 Json。请看代码转换源文件以代码生成的Json文件作为参考。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Create an options of saving the file.
JsonSaveOptions options = new JsonSaveOptions();
//Set the exporting range.
options.ExportArea = CellArea.CreateCellArea("B1", "C4");
//Load your source workbook
Workbook workbook = new Workbook("sample.xlsx");
//Convert the workbook to json file.
workbook.Save("sample_out.json", options);