toJSON
Serializes the workbook in the format that is defined in the configuration.
Note that this method is unable to serialize embedded images. To
properly save images you need to use saveJSON,
which is asynchronous (returns a Promise
).
Example - storing the spreadsheet to JSON
<div id="spreadsheet"></div>
<pre id="result"></pre>
<script>
$("#spreadsheet").kendoSpreadsheet({
sheets: [{
name: "Food Order",
mergedCells: [
"A1:G1"
],
rows: [{
height: 70,
cells: [{
value: "My Company", fontSize: 32, textAlign: "center"
}]
}]
}]
});
var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
var data = spreadsheet.toJSON();
var json = JSON.stringify(data, null, 2);
$("#spreadsheet").remove();
$("#result").text(json);
</script>
Returns
Object
- The serialized workbook.