GradientFill

GradientFill class

Represents the gradient fill.

class GradientFill;

Methods

MethodDescription
getGradientStops()Represents the gradient stop collection.
getFillType()Gets the gradient fill type.
getDirectionType()Gets the gradient direction type.
getAngle()The angle of linear fill.
setAngle(number)The angle of linear fill.
setGradient(GradientFillType, number, GradientDirectionType)Set the gradient fill type and direction.
setPresetThemeGradient(PresetThemeGradientType, ThemeColorType)Sets preset theme gradient fill.
setOneColorGradient(Color, number, GradientStyleType, number)Sets the specified fill to a one-color gradient. Only applies for Excel 2007.
setTwoColorGradient(Color, Color, GradientStyleType, number)Sets the specified fill to a two-color gradient. Only applies for Excel 2007.
setTwoColorGradient(Color, number, Color, number, GradientStyleType, number)Sets the specified fill to a two-color gradient. Only applies for Excel 2007.

getGradientStops()

Represents the gradient stop collection.

getGradientStops() : GradientStopCollection;

Returns

GradientStopCollection

getFillType()

Gets the gradient fill type.

getFillType() : GradientFillType;

Returns

GradientFillType

getDirectionType()

Gets the gradient direction type.

getDirectionType() : GradientDirectionType;

Returns

GradientDirectionType

getAngle()

The angle of linear fill.

getAngle() : number;

setAngle(number)

The angle of linear fill.

setAngle(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

setGradient(GradientFillType, number, GradientDirectionType)

Set the gradient fill type and direction.

setGradient(type: GradientFillType, angle: number, direction: GradientDirectionType) : void;

Parameters:

ParameterTypeDescription
typeGradientFillTypeGradient fill type.
anglenumberThe angle. Only applies for GradientFillType.Linear.
directionGradientDirectionTypeThe direction type. Only applies for GradientFillType.Radial and GradientFillType.Rectangle.

setPresetThemeGradient(PresetThemeGradientType, ThemeColorType)

Sets preset theme gradient fill.

setPresetThemeGradient(gradientType: PresetThemeGradientType, themeColorType: ThemeColorType) : void;

Parameters:

ParameterTypeDescription
gradientTypePresetThemeGradientTypeThe preset gradient type.
themeColorTypeThemeColorTypeThe theme color type.

setOneColorGradient(Color, number, GradientStyleType, number)

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

setOneColorGradient(color: Color, degree: number, style: GradientStyleType, variant: number) : void;

Parameters:

ParameterTypeDescription
colorColorOne gradient color.
degreenumberThe gradient degree. Can be a value from 0.0 (dark) through 1.0 (light).
styleGradientStyleTypeGradient shading style.
variantnumberThe 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(Color, Color, GradientStyleType, number)

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

setTwoColorGradient(color1: Color, color2: Color, style: GradientStyleType, variant: number) : void;

Parameters:

ParameterTypeDescription
color1ColorOne gradient color.
color2ColorTwo gradient color.
styleGradientStyleTypeGradient shading style.
variantnumberThe 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(Color, number, Color, number, GradientStyleType, number)

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

setTwoColorGradient(color1: Color, transparency1: number, color2: Color, transparency2: number, style: GradientStyleType, variant: number) : void;

Parameters:

ParameterTypeDescription
color1ColorOne gradient color.
transparency1numberThe degree of transparency of the color1 as a value from 0.0 (opaque) through 1.0 (clear).
color2ColorTwo gradient color.
transparency2numberThe degree of transparency of the color2 as a value from 0.0 (opaque) through 1.0 (clear).
styleGradientStyleTypeGradient shading style.
variantnumberThe 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.