XlsShapeFill module
- class XlsShapeFill.XlsShapeFill
Bases:
XlsObject,IShapeFillRepresents the fill formatting for a shape in an Excel worksheet.
This class provides properties and methods for manipulating fill formatting options such as solid colors, gradients, textures, patterns, and pictures. It allows for customization of fill appearance, transparency, and other visual aspects of shapes.
- property BackColor: Color
Gets or sets the background color of the shape fill.
Provides access to a Color object for custom background color settings.
- 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 shape fill.
Provides access to advanced color properties and settings for the background color.
- Returns:
An Office color object representing the background color.
- Return type:
- property BackKnownColor: ExcelColors
Gets or sets the background color from a predefined set of Excel colors.
- Returns:
An enumeration value representing the predefined Excel background color.
- Return type:
ExcelColors
- Clone(parent: SpireObject) XlsShapeFill
Creates a clone of this shape fill.
This method creates a new shape fill object with the same properties as this one.
- Parameters:
parent (SpireObject) – The parent object for the cloned shape fill.
- Returns:
A new shape fill object that is a copy of this one.
- Return type:
- CompareTo(twin: IGradient) int
Compares this shape fill with another gradient object.
This method is used to determine the relative order of two gradient objects.
- Parameters:
twin (IGradient) – The gradient object to compare with this shape fill.
- Returns:
- A value that indicates the relative order of the objects being compared.
Less than zero: This instance precedes the specified object. Zero: This instance equals the specified object. Greater than zero: This instance follows the specified object.
- Return type:
int
- CustomPicture
Sets a custom picture for the shape fill using a file path.
This method changes the fill type to picture and loads the image from the specified file.
- Parameters:
path (str) – The file path of the image to use as the fill.
- CustomTexture
Sets a custom texture for the shape fill using a file path.
This method changes the fill type to texture and loads the texture from the specified file.
- Parameters:
path (str) – The file path of the image to use as the texture.
- property FillType: ShapeFillType
Gets or sets the fill type for the shape.
The fill type determines how the shape is filled, such as solid color, gradient, pattern, texture, or picture.
- Returns:
An enumeration value representing the fill type.
- Return type:
ShapeFillType
- property ForeColor: Color
Gets or sets the foreground color of the shape fill.
Provides access to a Color object for custom foreground color settings. Used in patterns and gradients where both foreground and background colors are needed.
- 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 shape fill.
Provides access to advanced color properties and settings for the foreground color.
- Returns:
An Office color object representing the foreground color.
- Return type:
- property ForeKnownColor: ExcelColors
Gets or sets the foreground color from a predefined set of Excel colors.
Used in patterns and gradients where both foreground and background colors are needed.
- Returns:
An enumeration value representing the predefined Excel foreground color.
- Return type:
ExcelColors
- property GradientColorType: GradientColorType
Gets or sets the color type for gradient fills.
Determines how colors are applied in a gradient fill, such as one color or two colors.
- Returns:
An enumeration value representing the gradient color type.
- Return type:
GradientColorType
- property GradientDegree: float
Gets or sets the degree (angle) of the gradient fill.
This property defines the angle at which the gradient is applied, measured in degrees.
- Returns:
The angle of the gradient in degrees.
- Return type:
float
- property GradientStops: GradientStops
Gets the collection of gradient stops for the shape fill.
Gradient stops define the colors and positions used in a gradient fill.
- Returns:
A collection of gradient stops used in the gradient fill.
- Return type:
- property GradientStyle: GradientStyleType
Gets or sets the gradient style for the shape fill.
The gradient style defines the direction or pattern of the gradient, 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 gradient variant for the shape fill.
The gradient variant modifies the appearance of the gradient style, providing additional variations for each gradient style.
- Returns:
An enumeration value representing the gradient variant.
- Return type:
GradientVariantsType
- static IsDoubled(gradientStyle: GradientStyleType, variant: GradientVariantsType) bool
Determines if the specified gradient style and variant combination results in a doubled gradient.
A doubled gradient repeats the gradient pattern twice within the shape.
- Parameters:
gradientStyle (GradientStyleType) – The gradient style to check.
variant (GradientVariantsType) – The gradient variant to check.
- Returns:
True if the combination results in a doubled gradient; otherwise, False.
- Return type:
bool
- property IsGradientSupported: bool
Gets or sets whether gradient fills are supported for this shape.
Some shape types may not support gradient fills, and this property indicates that capability.
- Returns:
True if gradient fills are supported; otherwise, False.
- Return type:
bool
- static IsInverted(gradientStyle: GradientStyleType, variant: GradientVariantsType) bool
Determines if the specified gradient style and variant combination results in an inverted gradient.
An inverted gradient reverses the direction of the color transition.
- Parameters:
gradientStyle (GradientStyleType) – The gradient style to check.
variant (GradientVariantsType) – The gradient variant to check.
- Returns:
True if the combination results in an inverted gradient; otherwise, False.
- Return type:
bool
- OneColorGradient
Sets a one-color gradient fill for the shape with default settings.
This method changes the fill type to a one-color gradient using the default style and variant. The gradient transitions from the foreground color to a lighter or darker shade.
- property Pattern: GradientPatternType
Gets or sets the pattern type for the shape fill.
Patterns provide a predefined arrangement of foreground and background colors.
- Returns:
An enumeration value representing the pattern type.
- Return type:
GradientPatternType
- Patterned(pattern: GradientPatternType)
Sets a pattern fill for the shape.
This method changes the fill type to pattern and applies the specified pattern type.
- Parameters:
pattern (GradientPatternType) – The pattern type to apply to the shape fill.
- property PicStretch: PicStretch
Gets or sets the stretch settings for the picture fill.
When the picture is not tiled, this property controls how the picture is stretched to fill the shape.
- Returns:
An object that controls the picture stretch settings.
- Return type:
- property PicTile: PicTile
Gets or sets the tiling settings for the picture fill.
When the picture is tiled, this property controls how the picture is repeated to fill the shape.
- Returns:
An object that controls the picture tiling settings.
- Return type:
- property Picture: Stream
Gets the picture used for the shape fill.
When the fill type is set to picture, this property provides access to the image data.
- Returns:
A stream containing the picture data.
- Return type:
Stream
- property PictureName: str
Gets the name of the picture used for the shape fill.
When the fill type is set to picture, this property provides the name of the image.
- Returns:
The name of the picture.
- Return type:
str
- PresetGradient
Sets a preset gradient fill for the shape.
This method changes the fill type to gradient and applies the specified preset gradient.
- Parameters:
grad (GradientPresetType) – The preset gradient type to apply to the shape fill.
- property PresetGradientType: GradientPresetType
Gets or sets the preset gradient type for the shape fill.
Preset gradients are predefined gradient configurations that can be applied to the shape.
- Returns:
An enumeration value representing the preset gradient type.
- Return type:
GradientPresetType
- PresetTextured(texture: GradientTextureType)
Sets a preset texture fill for the shape.
This method changes the fill type to texture and applies the specified preset texture.
- Parameters:
texture (GradientTextureType) – The preset texture type to apply to the shape fill.
- Solid()
Sets a solid color fill for the shape.
This method changes the fill type to solid color using the current foreground color.
- property Texture: GradientTextureType
Gets or sets the texture type for the shape fill.
Textures provide a predefined pattern that can be applied to the shape fill.
- Returns:
An enumeration value representing the texture type.
- Return type:
GradientTextureType
- property Tile: bool
Gets or sets whether the picture fill is tiled.
When True, the picture is repeated to fill the shape area. When False, the picture is stretched.
- Returns:
True if the picture fill is tiled; otherwise, False.
- Return type:
bool
- property Transparency: float
Gets or sets the transparency level of the shape fill.
The value ranges from 0.0 (completely opaque) to 1.0 (completely transparent).
- Returns:
The transparency level of the shape fill.
- Return type:
float
- property TransparencyFrom: float
Gets or sets the starting transparency level for gradient fills.
Used in gradient fills to define the transparency at the starting point of the gradient. The value ranges from 0.0 (completely opaque) to 1.0 (completely transparent).
- Returns:
The starting transparency level for gradient fills.
- Return type:
float
- property TransparencyTo: float
Gets or sets the ending transparency level for gradient fills.
Used in gradient fills to define the transparency at the ending point of the gradient. The value ranges from 0.0 (completely opaque) to 1.0 (completely transparent).
- Returns:
The ending transparency level for gradient fills.
- Return type:
float
- TwoColorGradient
Sets a two-color gradient fill for the shape with default settings.
This method changes the fill type to a two-color gradient using the default style and variant. The gradient transitions between the foreground and background colors.
- property Visible: bool
Gets or sets whether the shape fill is visible.
- Returns:
True if the shape fill is visible; otherwise, False.
- Return type:
bool
