SpreadJS 13
SpreadJS Documentation / Sample Code / Sample Code for Cells / Setting the Cell Color
In This Topic
    Setting the Cell Color
    In This Topic

    You can set the backcolor and forecolor for the cells.

    Cell color

    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