[]
Represents a collection of border objects for a range or style.
Use this interface to apply common border settings, such as line style and color, to the outer and inside borders of the collection. Use this[BordersIndex] to access a specific edge, inside, or diagonal border.
public interface IBorders
Public Interface IBorders
IRange range = worksheet.Range["B2:E6"];
IBorders borders = range.Borders;
borders.LineStyle = BorderLineStyle.DashDot;
borders.Color = Color.Green;
borders[BordersIndex.EdgeTop].Color = Color.Red;
borders[BordersIndex.InsideHorizontal].LineStyle = BorderLineStyle.Double;
| Name | Description |
|---|---|
| Color | Gets or sets the Color object applied to the outer and inside borders in the collection. Use this property when you want to apply a fixed color. To apply a color that follows the workbook theme, use ThemeColor. To set a diagonal border, use this[BordersIndex] with DiagonalDown or DiagonalUp. |
| ColorIndex | Gets or sets the color index applied to the outer and inside borders in the collection. The value can be a palette color index or one of the special values defined by ColorDataIndex, such as Automatic or None. To set a diagonal border, use this[BordersIndex] with DiagonalDown or DiagonalUp. |
| Count | Gets the number of border objects in the collection. For a normal range border collection, this value is 6, representing the four edge borders and the two inside borders. |
| this[BordersIndex] | Gets a specific IBorder object from the collection by using a BordersIndex value. Use this indexer to access an edge border, inside border, or diagonal border. |
| LineStyle | Gets or sets the line style applied to the border collection. Setting this property applies the specified line style to the outer and inside borders in the collection. To set a diagonal border, use this[BordersIndex] with DiagonalDown or DiagonalUp. |
| ThemeColor | Gets or sets the ThemeColor value applied to the outer and inside borders in the collection. Use this property to apply a workbook theme color instead of a fixed Color. If the borders do not use a theme color, this property returns None. To set a diagonal border, use this[BordersIndex] with DiagonalDown or DiagonalUp. |
| TintAndShade | Gets or sets the tint and shade value applied to the outer and inside borders in the collection. The value ranges from -1 (darkest) to 1 (lightest), and 0 is neutral. The default value is 0. To set a diagonal border, use this[BordersIndex] with DiagonalDown or DiagonalUp. |
| Name | Description |
|---|---|
| Clear() | Clears the formatting from the borders in the collection. This method clears the collection-level outer and inside border formatting. It does not clear diagonal borders. To clear diagonal borders, access them through this[BordersIndex] with DiagonalDown or DiagonalUp. |