SpreadJS Documentation
toJSON Method
GC.Spread.Sheets Namespace > Workbook type : toJSON Method
- The serialization options.
Saves the object state to a JSON string.
Syntax
var instance = new GC.Spread.Sheets.Workbook(host);
var value; // Type: any
value = instance.toJSON(serializationOption);
function toJSON( 
   serializationOption : Object
) : any;

Parameters

serializationOption
- The serialization options.
Example
This example uses the toJSON method.
activeSheet.getCell(0,0).value(123);
var jsonStr = null;
//export
jsonStr = JSON.stringify(spread.toJSON(false));
//import
spread.fromJSON(JSON.parse(jsonStr));
alert(jsonStr);
Remarks

SpreadJS serializes the sheet's data source and the table's data source as a cell value if the includeBindingSource argument of the toJSON method is true.

The serializationOption parameter has the following arguments:

Name

Type

Description

serializationOption

Object

The serialization options.

Name

Type

Description

includeBindingSource

boolean

optional Whether to include the binding source when converting the workbook to json.
ignoreStyle

boolean

optional Whether to ignore the style when converting the workbook to json.
ignoreFormula

boolean

optional Whether to ignore the formula when converting the workbook to json.
rowHeadersAsFrozenColumns

boolean

optional Whether to treat the row headers as frozen columns when converting the workbook to json.
columnHeadersAsFrozenRows

boolean

optional Whether to treat the column headers as frozen rows when converting the workbook to json.

 

See Also

Reference

Workbook type