XlsGradient module

class XlsGradient.XlsGradient

Bases: XlsObject, IGradient

Represents a gradient fill in an Excel worksheet.

This class provides properties and methods for manipulating gradient fills in Excel, including gradient colors, styles, and variants. It extends XlsObject and implements the IGradient interface.

property BackColor: Color

Gets or sets the background color of the gradient.

Returns:

A Color object representing the background color.

Return type:

Color

property BackColorObject: OColor

Gets the Office color object for the background color of the gradient.

Returns:

An Office color object representing the background color.

Return type:

OColor

property BackKnownColor: ExcelColors

Gets or sets a predefined Excel color for the background of the gradient.

Returns:

An enumeration value representing the Excel color.

Return type:

ExcelColors

CompareTo(twin: IGradient) int

Compares the current gradient with another gradient.

Parameters:

twin (IGradient) – The gradient to compare with the current gradient.

Returns:

A value that indicates the relative order of the objects being compared.

Less than zero: This gradient precedes twin in the sort order. Zero: This gradient occurs in the same position in the sort order as twin. Greater than zero: This gradient follows twin in the sort order.

Return type:

int

property ForeColor: Color

Gets or sets the foreground color of the gradient.

Returns:

A Color object representing the foreground color.

Return type:

Color

property ForeColorObject: OColor

Gets the Office color object for the foreground color of the gradient.

Returns:

An Office color object representing the foreground color.

Return type:

OColor

property ForeKnownColor: ExcelColors

Gets or sets a predefined Excel color for the foreground of the gradient.

Returns:

An enumeration value representing the Excel color.

Return type:

ExcelColors

property GradientStyle: GradientStyleType

Gets or sets the style of the gradient.

Returns:

An enumeration value representing the gradient style.

Return type:

GradientStyleType

property GradientVariant: GradientVariantsType

Gets or sets the variant of the gradient.

Returns:

An enumeration value representing the gradient variant.

Return type:

GradientVariantsType

TwoColorGradient

Creates a two-color gradient with default settings.

This method sets up a two-color gradient using the current foreground and background colors with default style and variant settings.