SpreadJS 13
GC.Spread.Sheets Namespace / CellRange type / backgroundImage Method
The cell background image.
In This Topic
    backgroundImage Method
    In This Topic
    Gets or sets the background image for the cell.
    Syntax
    var instance = new GC.Spread.Sheets.CellRange(sheet, row, col, rowCount, colCount, sheetArea);
    var returnValue; // Type: any
    returnValue = instance.backgroundImage(value);
    function backgroundImage( 
       (optional) value : string
    ) : any;

    Parameters

    value
    The cell background image.

    Return Value

    If no value is set, returns the cell background image; otherwise, returns the cell.
    Example
    The following examples set the background image.
    var cellImage = document.getElementById("circle").src;
    var rowImage = "./css/images/quarter1.png";
    var colImage = document.getElementById("logo").src;
    sheet.getCell(3, 3).backgroundImage(cellImage);
    sheet.getCell(1, -1).backgroundImage(rowImage);
    sheet.getCell(-1, 1).backgroundImage(colImage);
    ...
    <img src="./css/images/box3.png" id="logo"/>
    <img src="./css/images/greencircle.png" id="circle"/>
    activeSheet.getRange(1, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).backgroundImage("images/example.jpg");
    activeSheet.getCell(1,1).backgroundImage("images/example.jpg");
    
    activeSheet.getRange(-1, 1, -1, 1, GC.Spread.Sheets.SheetArea.viewport).backgroundImage("images/example.jpg");
    See Also