Link Search Menu Expand Document

SSpread.SetCellBorder Method

Explanation Sets the color and linetype of the border around the cell.

First, specify the target ruled line part in the argument index. To set a border around the cell range, specify the cell range with the arguments col, row, col2, row2, and specify $CellBorderIndexOutline for the argument index. To set a ruled line in one cell, set the column number (same value) in the arguments col and col2, and the row number (same value) in row and row2.

Use the GetCellBorder method to get the color and line type of the cell border.
Call format SetCellBorder(col, row, col2, row2, index, color, style)
Return value None
Arguments col Column number of first cell
row Row number of the first cell
col2 Column number of last cell
row2 Row number of the last cell
index Border part to be set
Specify a combination of the following values.
Constant Value Description
$CellBorderIndexLeft 1 Left border of cell
$CellBorderIndexRight 2 Right border of cell
$CellBorderIndexTop 4 Cell top border
$CellBorderIndexBottom 8 Bottom border of cells
$CellBorderIndexOutline 16 Outer frame of cell range
color Border color
Specify a color constant or #RRGGBB format
style Line type
Specify the following values.
Constant Value Description
$CellBorderStyleDefault 0 No borders (display default grid)
$CellBorderStyleSolid 1 Solid line
$CellBorderStyleDash 2 Dashed line
$CellBorderStyleDot 3 Dotted line
$CellBorderStyleDashDot 4 Dash dotted line
$CellBorderStyleDashDotDot 5 Dash double-dotted line
$CellBorderStyleBlank 6 Erase ruled lines and grid lines
$CellBorderStyleFineSolid 11 Line with every other dot
$CellBorderStyleFineDash 12 Fine dashed line
$CellBorderStyleFineDot 13 Fine dotted line
$CellBorderStyleFineDashDot 14 Fine dash dotted line
$CellBorderStyleFineDashDotDot 15 Fine dash double-dotted line
Exception EXT-28 An error occurred in the SetCellBorder method
Example of use
    SetCellBorder(2, 2, 2, 2, $CellBorderIndexOutline, $RED, $CellBorderStyleSolid);
    SetCellBorder(2, 4, 3, 6, $CellBorderIndexOutline, $BLUE, $CellBorderStyleDot);
    SetCellBorder(4, 2, 4, 6, $CellBorderIndexRight + $CellBorderIndexTop, $GREEN, $CellBorderStyleFineSolid);
    
Related item GetCellBorder method