ExcelGradient module

class ExcelGradient.ExcelGradient

Bases: SpireObject, IGradient

Represents a gradient fill effect in Excel.

This class encapsulates the properties and methods for managing gradient fill effects in Excel shapes, cells, and other objects. It provides functionality to set gradient colors, styles, and variants, supporting both two-color and preset gradients.

property BackColor: Color

Gets or sets the ending color of the gradient.

Returns:

A Color object representing the ending color of the gradient.

Return type:

Color

property BackColorObject: OColor

Gets the ending color object of the gradient.

Returns:

An OColor object representing the ending color of the gradient.

Return type:

OColor

property BackKnownColor: ExcelColors

Gets or sets the ending color of the gradient using predefined Excel colors.

Returns:

An enumeration value representing the predefined Excel color.

Return type:

ExcelColors

CompareTo(gradient: IGradient) int

Compares this gradient with another gradient object.

This method compares the current gradient with the specified gradient object and returns an integer that indicates their relative position in the sort order.

Parameters:

gradient (IGradient) – The gradient to compare with this instance.

Returns:

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

Less than zero: This instance precedes the specified object in the sort order. Zero: This instance occurs in the same position in the sort order as the specified object. Greater than zero: This instance follows the specified object in the sort order.

Return type:

int

property ForeColor: Color

Gets or sets the starting color of the gradient.

Returns:

A Color object representing the starting color of the gradient.

Return type:

Color

property ForeColorObject: OColor

Gets the starting color object of the gradient.

Returns:

An OColor object representing the starting color of the gradient.

Return type:

OColor

property ForeKnownColor: ExcelColors

Gets or sets the starting color of the gradient using predefined Excel colors.

Returns:

An enumeration value representing the predefined Excel color.

Return type:

ExcelColors

property GradientStyle: GradientStyleType

Gets or sets the style of the gradient.

The gradient style determines the direction and pattern of the gradient fill, such as horizontal, vertical, diagonal, or radial.

Returns:

An enumeration value representing the gradient style.

Return type:

GradientStyleType

property GradientVariant: GradientVariantsType

Gets or sets the variant of the gradient.

The gradient variant determines the intensity and distribution of colors in the gradient, such as the number of color bands or the smoothness of the transition.

Returns:

An enumeration value representing the gradient variant.

Return type:

GradientVariantsType

TwoColorGradient

Creates a two-color gradient with default style and variant.

This method configures the gradient to use two colors (the fore color and back color) with default gradient style and variant settings.