GradientArrayWrapper module

class GradientArrayWrapper.GradientArrayWrapper

Bases: XlsObject, IGradient

Represents a wrapper for gradient arrays in Excel.

This class provides methods and properties for manipulating gradient effects in Excel, including two-color gradients with various styles and variants. It implements the IGradient interface to enable gradient formatting for cell backgrounds and other elements.

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 background color object of the gradient.

Returns:

An OColor object representing the background color.

Return type:

OColor

property BackKnownColor: ExcelColors

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

Returns:

An enumeration value representing the Excel color.

Return type:

ExcelColors

BeginUpdate()

Begins a batch update operation on the gradient properties.

This method should be called before making multiple changes to gradient properties to improve performance by deferring the actual updates until EndUpdate is called.

CompareTo(gradient: IGradient) int

Compares this gradient with another gradient.

Parameters:

gradient (IGradient) – The gradient to compare with.

Returns:

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

Return type:

int

EndUpdate()

Ends a batch update operation and applies all pending changes to gradient properties.

This method should be called after BeginUpdate to apply all the changes made to gradient properties in a single operation, improving performance.

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 foreground color object of the gradient.

Returns:

An OColor object representing the foreground color.

Return type:

OColor

property ForeKnownColor: ExcelColors

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

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 style and variant.

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