[]
An IBorder defines the formatting for a single border, including its color, line style, theme color, and tint or shade. Instances are typically obtained from an IBorders collection, such as the borders returned by IRange.getBorders() or IStyle.getBorders().
IBorder border = worksheet.getRange("A1").getBorders().get(BordersIndex.EdgeBottom);
border.setLineStyle(BorderLineStyle.Dashed);
border.setColor(Color.GetBlue());
voidclear()getColor()Color object assigned directly to this border.intThemeColor value associated with this border.doublevoidColor object for this border.voidsetColorIndex(int value) voidsetLineStyle(BorderLineStyle value) voidsetThemeColor(ThemeColor value) ThemeColor value for this border.voidsetTintAndShade(double value) Color object assigned directly to this border.Use this method to read the border color set by setColor(Color). If the border uses a theme color, use getThemeColor() to read the ThemeColor value instead.
IRange range = worksheet.getRange("B2:D4");
IBorder border = range.getBorders().get(BordersIndex.EdgeBottom);
border.setLineStyle(BorderLineStyle.Thick);
border.setColor(Color.GetRed());
Color color = border.getColor();
Color object assigned directly to this border.Color object for this border.Use this method when you want to apply a fixed color to the border. To apply a color that follows the workbook theme, use setThemeColor(ThemeColor) instead.
IRange range = worksheet.getRange("B2:D4");
IBorder border = range.getBorders().get(BordersIndex.EdgeBottom);
border.setLineStyle(BorderLineStyle.Thick);
border.setColor(Color.GetRed());
value - The Color object for this border.The returned value can be a palette color index or one of the special values defined by ColorDataIndex, such as ColorDataIndex.Automatic or ColorDataIndex.None. Use ColorDataIndex.forValue(int) to convert a special color index value to the corresponding enum constant.
IBorder border = worksheet.getRange("A1").getBorders().get(BordersIndex.EdgeBottom);
border.setLineStyle(BorderLineStyle.Thin);
border.setColorIndex(ColorDataIndex.Automatic.getValue());
ColorDataIndex colorIndex = ColorDataIndex.forValue(border.getColorIndex());
The value can be a palette color index or a special value defined by ColorDataIndex. Use 0 to apply the automatic color index.
IBorder border = worksheet.getRange("A1").getBorders().get(BordersIndex.EdgeBottom);
border.setLineStyle(BorderLineStyle.Thin);
border.setColorIndex(0);
value - The color index of this border.ThemeColor value associated with this border.Use this method to read the theme-based color assigned to the border. If the border does not use a theme color, this method returns ThemeColor.None.
IBorder border = worksheet.getRange("A1").getBorders().get(BordersIndex.EdgeBottom);
border.setThemeColor(ThemeColor.Accent1);
ThemeColor themeColor = border.getThemeColor();
ThemeColor value associated with this border.ThemeColor value for this border.Use this method to apply a workbook theme color to the border instead of a fixed Color. When the workbook theme changes, the displayed border color may change accordingly.
IBorder border = worksheet.getRange("A1").getBorders().get(BordersIndex.EdgeBottom);
border.setLineStyle(BorderLineStyle.Thin);
// Apply a theme color to the border.
border.setThemeColor(ThemeColor.Accent1);
value - The ThemeColor value for this border.The value ranges from -1 (darkest) to 1 (lightest), and 0 is neutral. The default value is 0.
IBorder border = worksheet.getRange("A1").getBorders().get(BordersIndex.EdgeBottom);
border.setColor(Color.GetBlue());
border.setTintAndShade(0.5);
double tintAndShade = border.getTintAndShade();
The value ranges from -1 (darkest) to 1 (lightest), and 0 is neutral.
IBorder border = worksheet.getRange("A1").getBorders().get(BordersIndex.EdgeBottom);
border.setColor(Color.GetBlue());
border.setTintAndShade(0.5);
value - The tint and shade value applied to the border color.
IBorder border = worksheet.getRange("B2:D4").getBorders().get(BordersIndex.EdgeBottom);
border.setLineStyle(BorderLineStyle.Thick);
BorderLineStyle lineStyle = border.getLineStyle();
BorderLineStyle value applied to the border.Use this method to control how the current border edge is drawn.
IRange range = worksheet.getRange("B2:D4");
IBorder border = range.getBorders().get(BordersIndex.EdgeBottom);
border.setLineStyle(BorderLineStyle.Double);
value - The line style to apply to the border.Use this method to remove the current settings applied to a single IBorder, such as its line style and color.
IBorder border = worksheet.getRange("A1").getBorders().get(BordersIndex.EdgeBottom);
border.setLineStyle(BorderLineStyle.Dashed);
border.setColor(Color.GetBlue());
border.clear();