SheetAPI.applyCellsBorder method is used to apply border style to a range of cells.
Parameters[[sheetId, startRow, startCol, endRow, endCol]]which define a list of sheetId and a range of cells need to be added border style.
{ position: position, color: color, width: width, lineType: lineType }Position is line position in the cell to be decorated. It should be one of the following items: 'outside', 'all', 'top', 'bottom', 'left', 'right', 'topbottom'.
Name | Property |
---|---|
outside | The outside of selected range of cells will be decorated. |
all | All border of the selected range of cells will be decorated. |
top | Top border of the selected range of cells will be decorated. |
bottom | Bottom border of the selected range of cells will be decorated. |
left | Left border of the selected range of cells will be decorated. |
right | Right border of the selected range of cells will be decorated. |
topbottom | Top and bottom border of the selected range of cells will be decorated. |
Color (option) is the color of line to be decorated. Such as: red, blue etc. Default is black.
Width (option) is the line width. Start with 1 (default value). In general, for bold line, please choose 2.
LineType (option) should be one of those items: dotted, dashed or solid (default is solid)
var json = {
fileName: 'Empty Sheet',
sheets: [
{name: 'One tab', id: 1, color: 'orange' }
]
};
SHEET_API.loadData(SHEET_API_HD, json, function() {
SHEET_API.applyCellsBorder(SHEET_API_HD, [[1, 2, 2, 4, 5]], {position: "all", color:"red", width:2} );
SHEET_API.applyCellsBorder(SHEET_API_HD, [[1, 6, 2, 8, 5]], {position:"topbottom", color:"blue", width:3, lineType:"dashed"} );
SHEET_API.applyCellsBorder(SHEET_API_HD, [[1, 10, 2, 12, 5]], {position:"outside", color:"orange", width:2, lineType:"dotted"} );
SHEET_API.applyCellsBorder(SHEET_API_HD, [[1, 14, 2, 16, 5]], {position:"bottom", color:"red", width:2, lineType:"solid"} );
SHEET_API.applyCellsBorder(SHEET_API_HD, [[1, 18, 2, 20, 2]], {position:"left", color:"purple"} );
}, this);