SpreadJS Documentation
Setting the Cell Color
SpreadJS Documentation > Sample Code > Sample Code for Cells > Setting the Cell Color

You can set the backcolor and forecolor for the cells.

Using Code

This example sets the backcolor and forecolor for a cell.

JavaScript
Copy Code

window.onload = function(){
       var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
       var activeSheet = spread.getActiveSheet();

//Set the backcolor and forecolor of a cell.
var cell = activeSheet.getCell(1, 1, GC.Spread.Sheets.SheetArea.viewport);
cell.backColor("Blue");
cell.foreColor("Red");
cell.value("Color");
                      }

See Also

Developer's Guide