SpreadJS 13
GC.Spread.Sheets Namespace / Workbook type / fromJSON Method
The spreadsheet data from deserialization.
The deserialization options.
Whether to ignore the style when converting json to the workbook.
Whether to ignore the formula when converting json to the workbook.
Whether to treat the frozen columns as row headers when converting json to the workbook.
Whether to treat the frozen rows as column headers when converting json to the workbook.
Whether to prevent recalculation after loading the json data.
In This Topic
    fromJSON Method
    In This Topic
    Loads the object state from the specified JSON string.
    Syntax
    var instance = new GC.Spread.Sheets.Workbook(host,
                                                options,
                                                options.sheetCount,
                                                options.font,
                                                options.allowUserDragMerge,
                                                options.allowUserDragDrop,
                                                options.allowUserDragFill,
                                                options.allowUserZoom,
                                                options.allowUserResize,
                                                options.allowUndo,
                                                options.allowSheetReorder,
                                                options.allowContextMenu,
                                                options.allowUserDeselect,
                                                options.defaultDragFillType,
                                                options.showDragFillSmartTag,
                                                options.showHorizontalScrollbar,
                                                options.showVerticalScrollbar,
                                                options.scrollbarShowMax,
                                                options.scrollbarMaxAlign,
                                                options.tabStripVisible,
                                                options.tabStripRatio,
                                                options.tabEditable,
                                                options.newTabVisible,
                                                options.tabNavigationVisible,
                                                options.cutCopyIndicatorVisible,
                                                options.cutCopyIndicatorBorderColor,
                                                options.backColor,
                                                options.backgroundImage,
                                                options.backgroundImageLayout,
                                                options.grayAreaBackColor,
                                                options.showResizeTip,
                                                options.showDragDropTip,
                                                options.showDragFillTip,
                                                options.showScrollTip,
                                                options.scrollIgnoreHidden,
                                                options.highlightInvalidData,
                                                options.useTouchLayout,
                                                options.hideSelection,
                                                options.resizeZeroIndicator,
                                                options.allowUserEditFormula,
                                                options.enableFormulaTextbox,
                                                options.autoFitType,
                                                options.referenceStyle,
                                                options.calcOnDemand,
                                                options.allowCopyPasteExcelStyle,
                                                options.allowExtendPasteRange,
                                                options.copyPasteHeaderOptions,
                                                options.scrollByPixel,
                                                options.scrollPixel,
                                                options.allowAutoCreateHyperlink,
                                                options.columnResizeMode,
                                                options.rowResizeMode,
                                                options.customList,
                                                options.scrollbarAppearance);
    var value; // Type: any
    value = instance.fromJSON(                                            workbookData,
                                                deserializationOptions,
                                                deserializationOptions.ignoreStyle,
                                                deserializationOptions.ignoreFormula,
                                                deserializationOptions.frozenColumnsAsRowHeaders,
                                                deserializationOptions.frozenRowsAsColumnHeaders,
                                                deserializationOptions.doNotRecalculateAfterLoad);
    function fromJSON( 
       workbookData : Object,
       (optional) deserializationOptions : Object,
       (optional) deserializationOptions.ignoreStyle : boolean,
       (optional) deserializationOptions.ignoreFormula : boolean,
       (optional) deserializationOptions.frozenColumnsAsRowHeaders : boolean,
       (optional) deserializationOptions.frozenRowsAsColumnHeaders : boolean,
       (optional) deserializationOptions.doNotRecalculateAfterLoad : boolean
    ) : any;

    Parameters

    workbookData
    The spreadsheet data from deserialization.
    deserializationOptions
    The deserialization options.
    deserializationOptions.ignoreStyle
    Whether to ignore the style when converting json to the workbook.
    deserializationOptions.ignoreFormula
    Whether to ignore the formula when converting json to the workbook.
    deserializationOptions.frozenColumnsAsRowHeaders
    Whether to treat the frozen columns as row headers when converting json to the workbook.
    deserializationOptions.frozenRowsAsColumnHeaders
    Whether to treat the frozen rows as column headers when converting json to the workbook.
    deserializationOptions.doNotRecalculateAfterLoad
    Whether to prevent recalculation after loading the json data.
    Example
    This example uses the fromJSON 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

    The deserializationOption parameter has the following arguments:

    Name

    Type

    Description

    deserializationOptions

    Object

    The deserialization options.

    Name

    Type

    Description

    ignoreStyle

    boolean

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

    boolean

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

    boolean

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

    boolean

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

    boolean

    optional Whether to prevent recalculation after loading the json data.
    See Also

    Reference

    Workbook type