GradientStops module

class GradientStops.GradientStops

Bases: SpireObject

Represents a collection of gradient stops in Excel.

This class provides properties and methods for managing gradient stops, which define the color transitions in a gradient fill. It allows for manipulating gradient properties such as angle, type, and color stops.

Add

Adds a gradient stop to the collection.

Parameters:

stop (XlsGradientStop) – The gradient stop to add.

property Angle: int

Gets or sets the angle of the gradient in degrees.

Returns:

The angle of the gradient in degrees.

Return type:

int

Clone() GradientStops

Creates a clone of this GradientStops object.

Returns:

A new GradientStops object that is a copy of this instance.

Return type:

GradientStops

DoubleGradientStops()

Doubles the gradient stops.

This method creates a mirror image of the gradient stops, effectively doubling the number of color transitions in the gradient.

property FillToRect: Rectangle

Gets or sets the rectangle that defines the end point of the gradient.

Returns:

A Rectangle object representing the end point of the gradient.

Return type:

Rectangle

property GradientType: GradientType

Gets or sets the type of the gradient.

Returns:

An enumeration value representing the gradient type.

Return type:

GradientType

InvertGradientStops()

Inverts the gradient stops.

This method reverses the order of the gradient stops, effectively inverting the color transitions in the gradient.

property IsDoubled: bool

Gets a value indicating whether the gradient stops are doubled.

Returns:

True if the gradient stops are doubled; otherwise, False.

Return type:

bool

Serialize(stream: Stream)

Serializes the gradient stops to a stream.

Parameters:

stream (Stream) – The stream to which the gradient stops will be serialized.

ShrinkGradientStops() GradientStops

Shrinks the gradient stops.

This method reduces the number of gradient stops by combining similar adjacent stops.

Returns:

A new GradientStops object with reduced stops.

Return type:

GradientStops