Spread 8.0 Documentation
SetCellBorder Method
Support Options
ActiveX Reference > ActiveX Methods > SetCellBorder Method

Glossary Item Box

SetCellBorder Method


See Also    DLL    Example

Applies To

fpSpread control

Description

Sets the color and style of the border around a cell.

Syntax

C++

void CSpreadSheet::SetCellBorder(long lCol, long lRow, long lCol2, long lRow2, long nIndex, unsigned long crColor, long nStyle);

Visual Basic

fpSpread1.SetCellBorder(ByVal lCol As Long, ByVal lRow As Long, ByVal lCol2 As Long, ByVal lRow2 As Long, ByVal nIndex As Long, ByVal crColor As OLE_COLOR, ByVal nStyle As CellBorderStyleConstants)

Parameters

The following parameters are available:

Parameter Description
lCol Column coordinate of the first (or only) cell
lRow Row coordinate of the first (or only) cell
lCol2 Column coordinate of the last (or only) cell
lRow2 Row coordinate of the last (or only) cell
nIndex Part of cell border to customize
You can combine values 1 (Left), 2 (Top), 4 (Right), and 8 (Bottom) using the OR operator.
Value Constant Description
0 (not available) None
1 CellBorderIndexLeft Left side of cell
2 CellBorderIndexRight Right side of cell
4 CellBorderIndexTop Top of cell
8 CellBorderIndexBottom Bottom of cell
15 (not available) All sides of the cell
16 CellBorderIndexOutline Outline of the cell range
crColor Border color
Value can be SPRD_COLOR_DEFAULT (–1), which specifies the default color.
nStyle Border style (see Remarks for illustration of styles)
Use one of the following values:
Value Constant Description
0 CellBorderStyleDefault No border
Displays the default grid
1 CellBorderStyleSolid Solid border
2 CellBorderStyleDash Dash border
3 CellBorderStyleDot Dot border
4 CellBorderStyleDashDot Dash dot border
5 CellBorderStyleDashDotDot Dash dot dot border
6 CellBorderStyleBlank Erases border and grid
11 CellBorderStyleFineSolid Fine solid border
12 CellBorderStyleFineDash Fine dash border
13 CellBorderStyleFineDot Fine dot border
14 CellBorderStyleFineDashDot Fine dash dot border
15 CellBorderStyleFineDashDotDot Fine dash dot dot border

Remarks

To set the cell border color or style for a cell, first specify the side for which you want to set the style by setting the Index parameter.

This method is called for the current sheet setting unless you first set the Sheet property to specify the sheet with which you want to work.

To specify a range of cells around which to set a border, set the Col and Row parameters to indicate the upper left cell in the range, set the Col2 and Row2 parameters to indicate the lower right cell in the range, and set the Index parameter to 16 (CellBorderIndexOutline).

To specify a single cell around which to set a border, set the Col and Col2 parameters to indicate the column for the cell, and set the Row and Row2 parameters to indicate the row for the cell.

Use the GetCellBorder method to return the border colors and styles of each side of a cell.

The following table illustrates the twelve available border styles:

Default

Solid

Dash

Dot

Dash Dot

Dash Dot Dot

Blank

Fine Solid

Fine Dash

Fine Dot

Fine Dash Dot

Fine Dash Dot Dot

Return Type

None

See Also

Customizing Cell Borders

Sheet property

GetCellBorder method

DLL Correspondence

SSSetBorder, SSSetBorderRange functions

Copyright © GrapeCity, inc. All rights reserved.