SpreadJS Documentation
setDefaultStyle Method
The style to set.
The sheet area. If this parameter is not provided, it defaults to viewport.
Sets the default style information for the sheet.
Syntax
var instance = new GcSpread.Sheets.Sheet(name);
var value; // Type: any
value = instance.setDefaultStyle(style, sheetArea);
function setDefaultStyle( 
   style : Style,
   sheetArea : SheetArea
) : any;

Parameters

style
The style to set.
sheetArea
The sheet area. If this parameter is not provided, it defaults to viewport.
Example
This example creates a default style.
//setDefaultStyle
activeSheet.setRowCount(5, GcSpread.Sheets.SheetArea.viewport);
activeSheet.setColumnCount(5, GcSpread.Sheets.SheetArea.viewport);

    //Set the default styles.
    var defaultStyle = new GcSpread.Sheets.Style();
    defaultStyle.backColor = "LemonChiffon";
    defaultStyle.foreColor = "Red";
    defaultStyle.formatter = "0.00";
    defaultStyle.hAlign = GcSpread.Sheets.HorizontalAlign.center;
    defaultStyle.borderLeft = new GcSpread.Sheets.LineBorder("Green");
    defaultStyle.borderTop = new GcSpread.Sheets.LineBorder("Green");
    defaultStyle.borderRight = new GcSpread.Sheets.LineBorder("Green");
    defaultStyle.borderBottom = new GcSpread.Sheets.LineBorder("Green");
    activeSheet.setDefaultStyle(defaultStyle, GcSpread.Sheets.SheetArea.viewport);

    var rowCount = activeSheet.getRowCount();
    var colCount = activeSheet.getColumnCount();
    for(var i = 0; i < rowCount; i++){
        for(var j = 0; j < colCount; j++){
            activeSheet.setValue(i, j, i+j, GcSpread.Sheets.SheetArea.viewport);
        }
    }
See Also

Reference

Sheet type

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.