GradientFill

GradientFill class

Represents the gradient fill.

class GradientFill;

Properties

PropertyTypeDescription
gradientStopsGradientStopCollectionReadonly. Represents the gradient stop collection.
fillTypeGradientFillTypeReadonly. Gets the gradient fill type.
directionTypeGradientDirectionTypeReadonly. Gets the gradient direction type.
anglenumberThe angle of linear fill.

Methods

MethodDescription
getGradientStops()@deprecated. Please use the ‘gradientStops’ property instead. Represents the gradient stop collection.
getFillType()@deprecated. Please use the ‘fillType’ property instead. Gets the gradient fill type.
getDirectionType()@deprecated. Please use the ‘directionType’ property instead. Gets the gradient direction type.
getAngle()@deprecated. Please use the ‘angle’ property instead. The angle of linear fill.
setAngle(number)@deprecated. Please use the ‘angle’ property instead. 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.
isNull()Checks whether the implementation object is null.

gradientStops

Readonly. Represents the gradient stop collection.

gradientStops : GradientStopCollection;

fillType

Readonly. Gets the gradient fill type.

fillType : GradientFillType;

directionType

Readonly. Gets the gradient direction type.

directionType : GradientDirectionType;

angle

The angle of linear fill.

angle : number;

getGradientStops()

@deprecated. Please use the ‘gradientStops’ property instead. Represents the gradient stop collection.

getGradientStops() : GradientStopCollection;

Returns

GradientStopCollection

getFillType()

@deprecated. Please use the ‘fillType’ property instead. Gets the gradient fill type.

getFillType() : GradientFillType;

Returns

GradientFillType

getDirectionType()

@deprecated. Please use the ‘directionType’ property instead. Gets the gradient direction type.

getDirectionType() : GradientDirectionType;

Returns

GradientDirectionType

getAngle()

@deprecated. Please use the ‘angle’ property instead. The angle of linear fill.

getAngle() : number;

setAngle(number)

@deprecated. Please use the ‘angle’ property instead. 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.

isNull()

Checks whether the implementation object is null.

isNull() : boolean;