ExcelをJSONに変換
Contents
[
Hide
]
Aspose.CellsはワークブックをJson(JavaScript Object Notation)ファイルに変換することをサポートしています。
ExcelワークブックをJSONに変換する方法
Aspose.Cells Javaライブラリが最適な決定を提供しているため、ExcelワークブックをJSONに変換する方法を悩む必要はありません。 Aspose.Cells Java APIは、スプレッドシートをJSON形式に変換するサポートを提供します。ワークブックをJSONにエクスポートするには、Workbook.saveメソッドの第2パラメーターとしてSaveFormat.JSONを渡します。ワークシートをJSONにエクスポートするための追加の設定を指定するには、JsonSaveOptionsクラスを使用できます。
以下のコード例は、ExcelワークブックをJsonにエクスポートすることを示しています。参照のためにコードで生成されたJsonファイルのsource fileを変換するコードを参照してください。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Load Source Excel file | |
Workbook workbook = new Workbook("sample.xlsx"); | |
//Save the workbook in JSON format | |
workbook.save("sample_out.json", SaveFormat.JSON); |
以下のコード例は、JsonSaveOptionsクラスを使用して追加の設定を指定することで、ExcelワークブックをJsonにエクスポートする方法を示しています。参照のためにコードで生成されたJsonファイルのsource fileを変換するコードを参照してください。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create an options of saving the file. | |
JsonSaveOptions options = new JsonSaveOptions(); | |
//Set the exporting range. | |
options.setExportArea(CellArea.createCellArea("B1", "C4")); | |
//Load Source Excel file | |
Workbook workbook = new Workbook("sample.xlsx"); | |
//Save the workbook in JSON format | |
workbook.save("sample_out.json", options); |