XlsBorder module

class XlsBorder.XlsBorder

Bases: XlsObject, IBorder

Represents a border in an Excel worksheet.

This class provides properties and methods for manipulating borders in Excel, including accessing and modifying border colors, line styles, and diagonal lines. It extends XlsObject and implements the IBorder interface.

property BorderIndex: BordersLineType

Gets the border index indicating which side of the cell this border represents.

Returns:

An enumeration value representing the border position.

Return type:

BordersLineType

property Color: Color

Gets or sets the primary color of the border.

Use the RGB function to create a color value.

Returns:

A Color object representing the border color.

Return type:

Color

static ColorToExcelColor(color: ExcelColors) ExcelColors

Converts a color to an Excel color.

Parameters:

color (ExcelColors) – The color to convert.

Returns:

The converted Excel color.

Return type:

ExcelColors

CopyFrom(baseBorder: IBorder)

Copies properties from another border.

Parameters:

baseBorder (IBorder) – The source border to copy properties from.

property KnownColor: ExcelColors

Gets or sets a predefined Excel color for the border.

Returns:

An enumeration value representing the Excel color.

Return type:

ExcelColors

property LineStyle: LineStyleType

Gets or sets the line style for the border.

Returns:

An enumeration value representing the line style.

Return type:

LineStyleType

property OColor: OColor

Gets the Office color of the border.

Returns:

An object representing the Office color.

Return type:

OColor

SetThemeColor(type: ThemeColorType, tint: float)

Sets a theme color for the border.

Parameters:
  • type (ThemeColorType) – The theme color type to set.

  • tint (float) – The tint value to apply to the theme color.

property ShowDiagonalLine: bool

Gets or sets a value indicating whether to show diagonal lines.

Returns:

True if diagonal lines are shown; otherwise, False.

Return type:

bool

setLineStyleAndColor(borderLine: LineStyleType, borderColor: ExcelColors)

Sets both the line style and color of the border in a single operation.

Parameters:
  • borderLine (LineStyleType) – The line style to set.

  • borderColor (ExcelColors) – The color to set.