GradientFill

GradientFill class

Represents the gradient fill.

Properties

NameTypeDescription
GradientStopsGradientStopCollectionRepresents the gradient stop collection.
FillTypeintGets the gradient fill type. The value of the property is GradientFillType integer constant.
DirectionTypeintGets the gradient direction type. The value of the property is GradientDirectionType integer constant.
AnglefloatThe angle of linear fill.
GradientColor1ColorGets gradient color 1. Applies to Excel97-2003
GradientColor2ColorGets gradient color 2. Applies to Excel97-2003
GradientDegreefloatGets gradient degree. Applies to Excel97-2003
GradientColorTypeintGets gradient color type. Applies to Excel97-2003 The value of the property is GradientColorType integer constant.
PresetColorintReturns the gradient preset color for the specified fill. Applies to Excel97-2003 The value of the property is GradientP
VariantintGets variant. Applies to Excel97-2003
GradientStyleintGets gradient style type. Applies to Excel97-2003 The value of the property is GradientStyleType integer constant.

Methods

NameDescription
setGradientSet the gradient fill type and direction.
setPresetThemeGradientSets preset theme gradient fill.
setPresetColorGradientSets the specified fill to a preset-color gradient. Only applies for Excel 97-2003
setOneColorGradientSets the specified fill to a one-color gradient. Only applies for Excel 2007.
setTwoColorGradientSets the specified fill to a two-color gradient. Only applies for Excel 2007.
equals/
hashCodeGets the hash code.

GradientFill.GradientStops property

Represents the gradient stop collection.

Type: GradientStopCollection

GradientFill.FillType property

Gets the gradient fill type. The value of the property is GradientFillType integer constant.

Type: int

GradientFill.DirectionType property

Gets the gradient direction type. The value of the property is GradientDirectionType integer constant.

Type: int

GradientFill.Angle property

The angle of linear fill.

Type: float

GradientFill.GradientColor1 property

Gets gradient color 1. Applies to Excel97-2003

Type: Color

GradientFill.GradientColor2 property

Gets gradient color 2. Applies to Excel97-2003

Type: Color

GradientFill.GradientDegree property

Gets gradient degree. Applies to Excel97-2003

Type: float

GradientFill.GradientColorType property

Gets gradient color type. Applies to Excel97-2003 The value of the property is GradientColorType integer constant.

Type: int

GradientFill.PresetColor property

Returns the gradient preset color for the specified fill. Applies to Excel97-2003 The value of the property is GradientPresetType integer constant.

Type: int

GradientFill.Variant property

Gets variant. Applies to Excel97-2003

Type: int

GradientFill.GradientStyle property

Gets gradient style type. Applies to Excel97-2003 The value of the property is GradientStyleType integer constant.

Type: int

setGradient(type, angle, direction)

Set the gradient fill type and direction.

ParameterTypeDescription
typeintA GradientFillType value. Gradient fill type.
anglefloatThe angle. Only applies for GradientFillType.Linear.
directionintA GradientDirectionType value. The direction type. Only applies for GradientFillType.Radial and GradientFillType.Rectangle.

setPresetThemeGradient(gradientType, themeColorType)

Sets preset theme gradient fill.

ParameterTypeDescription
gradientTypeintA PresetThemeGradientType value. The preset gradient type.
themeColorTypeintA ThemeColorType value. The theme color type.

setPresetColorGradient(presetColor, style, variant)

Sets the specified fill to a preset-color gradient. Only applies for Excel 97-2003

ParameterTypeDescription
presetColorintA GradientPresetType value. Preset color type
styleintA GradientStyleType value. Gradient shading style.
variantintThe gradient variant. Can be a value from 1 through 4, corresponding to one of the four variants on the Gradient tab in the Fill Effects dialog box. If style is GradientStyle.FromCenter, the Variant argument can only be 1 or 2.

setOneColorGradient(color, degree, style, variant)

Sets the specified fill to a one-color gradient. Only applies for Excel 2007.

ParameterTypeDescription
colorColorOne gradient color.
degreefloatThe gradient degree. Can be a value from 0.0 (dark) through 1.0 (light).
styleintA GradientStyleType value. Gradient shading style.
variantintThe gradient variant. Can be a value from 1 through 4, corresponding to one of the four variants on the Gradient tab in the Fill Effects dialog box. If style is GradientStyle.FromCenter, the Variant argument can only be 1 or 2.

setTwoColorGradient(color1, color2, style, variant) (1 of 2)

Sets the specified fill to a two-color gradient. Only applies for Excel 2007.

ParameterTypeDescription
color1ColorOne gradient color.
color2ColorTwo gradient color.
styleintA GradientStyleType value. Gradient shading style.
variantintThe gradient variant. Can be a value from 1 through 4, corresponding to one of the four variants on the Gradient tab in the Fill Effects dialog box. If style is GradientStyle.FromCenter, the Variant argument can only be 1 or 2.

setTwoColorGradient(color1, transparency1, color2, transparency2, style, variant) (2 of 2)

Sets the specified fill to a two-color gradient. Only applies for Excel 2007.

ParameterTypeDescription
color1ColorOne gradient color.
transparency1floatThe degree of transparency of the color1 as a value from 0.0 (opaque) through 1.0 (clear).
color2ColorTwo gradient color.
transparency2floatThe degree of transparency of the color2 as a value from 0.0 (opaque) through 1.0 (clear).
styleintA GradientStyleType value. Gradient shading style.
variantintThe gradient variant. Can be a value from 1 through 4, corresponding to one of the four variants on the Gradient tab in the Fill Effects dialog box. If style is GradientStyle.FromCenter, the Variant argument can only be 1 or 2.

equals(obj)

/

ParameterTypeDescription
objObject

hashCode()

Gets the hash code.