ExcelをJSONに変換

ExcelワークブックをJSONに変換

ExcelワークブックをJSON形式に変換する方法を疑問に思う必要はありません。なぜなら、Apose.Cells for .NETライブラリには最良の決定があるからです。Aspose.Cells APIは、スプレッドシートをJSON形式に変換するサポートを提供します。ワークブックをJSONにエクスポートするには、Workbook.Saveメソッドの第2パラメータにSaveFormat.Jsonを渡します。JsonSaveOptionsクラスを使用してワークシートを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ファイルのsource fileを変換するコードを参照してください。

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