Word.FillFormat class
Represents the fill formatting for a shape or text.
- Extends
Remarks
Properties
| background |
Returns a |
| context | The request context associated with the object. This connects the add-in's process to the Office host application's process. |
| foreground |
Returns a |
| gradient |
Specifies the angle of the gradient fill. The valid range of values is from 0 to 359.9. |
| gradient |
Gets the gradient color type. |
| gradient |
Returns how dark or light a one-color gradient fill is. A value of 0 means that black is mixed in with the shape's foreground color to form the gradient. A value of 1 means that white is mixed in. Values between 0 and 1 mean that a darker or lighter shade of the foreground color is mixed in. |
| gradient |
Returns the gradient style for the fill. |
| gradient |
Returns the gradient variant for the fill as an integer value from 1 to 4 for most gradient fills. |
| is |
Specifies if the object, or the formatting applied to it, is visible. |
| pattern | Returns a |
| preset |
Returns the preset gradient type for the fill. |
| preset |
Gets the preset texture. |
| rotate |
Specifies whether the fill rotates with the shape. |
| texture |
Specifies the alignment (the origin of the coordinate grid) for the tiling of the texture fill. |
| texture |
Specifies the horizontal scaling factor for the texture fill. |
| texture |
Returns the name of the custom texture file for the fill. |
| texture |
Specifies the horizontal offset of the texture from the origin in points. |
| texture |
Specifies the vertical offset of the texture. |
| texture |
Specifies whether the texture is tiled. |
| texture |
Returns the texture type for the fill. |
| texture |
Specifies the vertical scaling factor for the texture fill as a value between 0.0 and 1.0. |
| transparency | Specifies the degree of transparency of the fill for a shape as a value between 0.0 (opaque) and 1.0 (clear). |
| type | Gets the fill format type. |
Methods
| load(options) | Queues up a command to load the specified properties of the object. You must call |
| load(property |
Queues up a command to load the specified properties of the object. You must call |
| load(property |
Queues up a command to load the specified properties of the object. You must call |
| set(properties, options) | Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. |
| set(properties) | Sets multiple properties on the object at the same time, based on an existing loaded object. |
| set |
Sets the fill to a one-color gradient. |
| set |
Sets the fill to a one-color gradient. |
| set |
Sets the fill to a pattern. |
| set |
Sets the fill to a pattern. |
| set |
Sets the fill to a preset gradient. The gradient style.The gradient variant. Can be a value from 1 to 4.The preset gradient type. |
| set |
Sets the fill to a preset gradient. The gradient style.The gradient variant. Can be a value from 1 to 4.The preset gradient type. |
| set |
Sets the fill to a preset texture. |
| set |
Sets the fill to a preset texture. |
| set |
Sets the fill to a two-color gradient. |
| set |
Sets the fill to a two-color gradient. |
| solid() | Sets the fill to a uniform color. |
| toJSON() | Overrides the JavaScript |
| track() | Track the object for automatic adjustment based on surrounding changes in the document. This call is a shorthand for context.trackedObjects.add(thisObject). If you're using this object across |
| untrack() | Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You'll need to call |
Property Details
backgroundColor
Returns a ColorFormat object that represents the background color for the fill.
readonly backgroundColor: Word.ColorFormat;
Property Value
Remarks
context
The request context associated with the object. This connects the add-in's process to the Office host application's process.
context: RequestContext;
Property Value
foregroundColor
Returns a ColorFormat object that represents the foreground color for the fill.
readonly foregroundColor: Word.ColorFormat;
Property Value
Remarks
gradientAngle
Specifies the angle of the gradient fill. The valid range of values is from 0 to 359.9.
gradientAngle: number;
Property Value
number
Remarks
gradientColorType
Gets the gradient color type.
readonly gradientColorType: Word.GradientColorType | "Mixed" | "OneColor" | "TwoColors" | "PresetColors" | "MultiColor";
Property Value
Word.GradientColorType | "Mixed" | "OneColor" | "TwoColors" | "PresetColors" | "MultiColor"
Remarks
gradientDegree
Returns how dark or light a one-color gradient fill is. A value of 0 means that black is mixed in with the shape's foreground color to form the gradient. A value of 1 means that white is mixed in. Values between 0 and 1 mean that a darker or lighter shade of the foreground color is mixed in.
readonly gradientDegree: number;
Property Value
number
Remarks
gradientStyle
Returns the gradient style for the fill.
readonly gradientStyle: Word.GradientStyle | "Mixed" | "Horizontal" | "Vertical" | "DiagonalUp" | "DiagonalDown" | "FromCorner" | "FromTitle" | "FromCenter";
Property Value
Word.GradientStyle | "Mixed" | "Horizontal" | "Vertical" | "DiagonalUp" | "DiagonalDown" | "FromCorner" | "FromTitle" | "FromCenter"
Remarks
gradientVariant
Returns the gradient variant for the fill as an integer value from 1 to 4 for most gradient fills.
readonly gradientVariant: number;
Property Value
number
Remarks
isVisible
Specifies if the object, or the formatting applied to it, is visible.
isVisible: boolean;
Property Value
boolean
Remarks
pattern
Returns a PatternType value that represents the pattern applied to the fill or line.
readonly pattern: Word.PatternType | "Mixed" | "Percent5" | "Percent10" | "Percent20" | "Percent25" | "Percent30" | "Percent40" | "Percent50" | "Percent60" | "Percent70" | "Percent75" | "Percent80" | "Percent90" | "DarkHorizontal" | "DarkVertical" | "DarkDownwardDiagonal" | "DarkUpwardDiagonal" | "SmallCheckerBoard" | "Trellis" | "LightHorizontal" | "LightVertical" | "LightDownwardDiagonal" | "LightUpwardDiagonal" | "SmallGrid" | "DottedDiamond" | "WideDownwardDiagonal" | "WideUpwardDiagonal" | "DashedUpwardDiagonal" | "DashedDownwardDiagonal" | "NarrowVertical" | "NarrowHorizontal" | "DashedVertical" | "DashedHorizontal" | "LargeConfetti" | "LargeGrid" | "HorizontalBrick" | "LargeCheckerBoard" | "SmallConfetti" | "ZigZag" | "SolidDiamond" | "DiagonalBrick" | "OutlinedDiamond" | "Plaid" | "Sphere" | "Weave" | "DottedGrid" | "Divot" | "Shingle" | "Wave" | "Horizontal" | "Vertical" | "Cross" | "DownwardDiagonal" | "UpwardDiagonal" | "DiagonalCross";
Property Value
Word.PatternType | "Mixed" | "Percent5" | "Percent10" | "Percent20" | "Percent25" | "Percent30" | "Percent40" | "Percent50" | "Percent60" | "Percent70" | "Percent75" | "Percent80" | "Percent90" | "DarkHorizontal" | "DarkVertical" | "DarkDownwardDiagonal" | "DarkUpwardDiagonal" | "SmallCheckerBoard" | "Trellis" | "LightHorizontal" | "LightVertical" | "LightDownwardDiagonal" | "LightUpwardDiagonal" | "SmallGrid" | "DottedDiamond" | "WideDownwardDiagonal" | "WideUpwardDiagonal" | "DashedUpwardDiagonal" | "DashedDownwardDiagonal" | "NarrowVertical" | "NarrowHorizontal" | "DashedVertical" | "DashedHorizontal" | "LargeConfetti" | "LargeGrid" | "HorizontalBrick" | "LargeCheckerBoard" | "SmallConfetti" | "ZigZag" | "SolidDiamond" | "DiagonalBrick" | "OutlinedDiamond" | "Plaid" | "Sphere" | "Weave" | "DottedGrid" | "Divot" | "Shingle" | "Wave" | "Horizontal" | "Vertical" | "Cross" | "DownwardDiagonal" | "UpwardDiagonal" | "DiagonalCross"
Remarks
presetGradientType
Returns the preset gradient type for the fill.
readonly presetGradientType: Word.PresetGradientType | "Mixed" | "EarlySunset" | "LateSunset" | "Nightfall" | "Daybreak" | "Horizon" | "Desert" | "Ocean" | "CalmWater" | "Fire" | "Fog" | "Moss" | "Peacock" | "Wheat" | "Parchment" | "Mahogany" | "Rainbow" | "RainbowII" | "Gold" | "GoldII" | "Brass" | "Chrome" | "ChromeII" | "Silver" | "Sapphire";
Property Value
Word.PresetGradientType | "Mixed" | "EarlySunset" | "LateSunset" | "Nightfall" | "Daybreak" | "Horizon" | "Desert" | "Ocean" | "CalmWater" | "Fire" | "Fog" | "Moss" | "Peacock" | "Wheat" | "Parchment" | "Mahogany" | "Rainbow" | "RainbowII" | "Gold" | "GoldII" | "Brass" | "Chrome" | "ChromeII" | "Silver" | "Sapphire"
Remarks
presetTexture
Gets the preset texture.
readonly presetTexture: Word.PresetTexture | "Mixed" | "Papyrus" | "Canvas" | "Denim" | "WovenMat" | "WaterDroplets" | "PaperBag" | "FishFossil" | "Sand" | "GreenMarble" | "WhiteMarble" | "BrownMarble" | "Granite" | "Newsprint" | "RecycledPaper" | "Parchment" | "Stationery" | "BlueTissuePaper" | "PinkTissuePaper" | "PurpleMesh" | "Bouquet" | "Cork" | "Walnut" | "Oak" | "MediumWood";
Property Value
Word.PresetTexture | "Mixed" | "Papyrus" | "Canvas" | "Denim" | "WovenMat" | "WaterDroplets" | "PaperBag" | "FishFossil" | "Sand" | "GreenMarble" | "WhiteMarble" | "BrownMarble" | "Granite" | "Newsprint" | "RecycledPaper" | "Parchment" | "Stationery" | "BlueTissuePaper" | "PinkTissuePaper" | "PurpleMesh" | "Bouquet" | "Cork" | "Walnut" | "Oak" | "MediumWood"
Remarks
rotateWithObject
Specifies whether the fill rotates with the shape.
rotateWithObject: boolean;
Property Value
boolean
Remarks
textureAlignment
Specifies the alignment (the origin of the coordinate grid) for the tiling of the texture fill.
textureAlignment: Word.TextureAlignment | "Mixed" | "TopLeft" | "Top" | "TopRight" | "Left" | "Center" | "Right" | "BottomLeft" | "Bottom" | "BottomRight";
Property Value
Word.TextureAlignment | "Mixed" | "TopLeft" | "Top" | "TopRight" | "Left" | "Center" | "Right" | "BottomLeft" | "Bottom" | "BottomRight"
Remarks
textureHorizontalScale
Specifies the horizontal scaling factor for the texture fill.
textureHorizontalScale: number;
Property Value
number
Remarks
textureName
Returns the name of the custom texture file for the fill.
readonly textureName: string;
Property Value
string
Remarks
textureOffsetX
Specifies the horizontal offset of the texture from the origin in points.
textureOffsetX: number;
Property Value
number
Remarks
textureOffsetY
Specifies the vertical offset of the texture.
textureOffsetY: number;
Property Value
number
Remarks
textureTile
Specifies whether the texture is tiled.
textureTile: boolean;
Property Value
boolean
Remarks
textureType
Returns the texture type for the fill.
readonly textureType: Word.TextureType | "Mixed" | "Preset" | "UserDefined";
Property Value
Word.TextureType | "Mixed" | "Preset" | "UserDefined"
Remarks
textureVerticalScale
Specifies the vertical scaling factor for the texture fill as a value between 0.0 and 1.0.
textureVerticalScale: number;
Property Value
number
Remarks
transparency
Specifies the degree of transparency of the fill for a shape as a value between 0.0 (opaque) and 1.0 (clear).
transparency: number;
Property Value
number
Remarks
type
Gets the fill format type.
readonly type: Word.FillType | "Mixed" | "Solid" | "Patterned" | "Gradient" | "Textured" | "Background" | "Picture";
Property Value
Word.FillType | "Mixed" | "Solid" | "Patterned" | "Gradient" | "Textured" | "Background" | "Picture"
Remarks
Method Details
load(options)
Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.
load(options?: Word.Interfaces.FillFormatLoadOptions): Word.FillFormat;
Parameters
Provides options for which properties of the object to load.
Returns
load(propertyNames)
Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.
load(propertyNames?: string | string[]): Word.FillFormat;
Parameters
- propertyNames
-
string | string[]
A comma-delimited string or an array of strings that specify the properties to load.
Returns
load(propertyNamesAndPaths)
Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.
load(propertyNamesAndPaths?: {
select?: string;
expand?: string;
}): Word.FillFormat;
Parameters
- propertyNamesAndPaths
-
{ select?: string; expand?: string; }
propertyNamesAndPaths.select is a comma-delimited string that specifies the properties to load, and propertyNamesAndPaths.expand is a comma-delimited string that specifies the navigation properties to load.
Returns
set(properties, options)
Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type.
set(properties: Interfaces.FillFormatUpdateData, options?: OfficeExtension.UpdateOptions): void;
Parameters
- properties
- Word.Interfaces.FillFormatUpdateData
A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called.
- options
- OfficeExtension.UpdateOptions
Provides an option to suppress errors if the properties object tries to set any read-only properties.
Returns
void
set(properties)
Sets multiple properties on the object at the same time, based on an existing loaded object.
set(properties: Word.FillFormat): void;
Parameters
- properties
- Word.FillFormat
Returns
void
setOneColorGradient(style, variant, degree)
Sets the fill to a one-color gradient.
setOneColorGradient(style: Word.GradientStyle, variant: number, degree: number): void;
Parameters
- style
- Word.GradientStyle
The gradient style.
- variant
-
number
The gradient variant. Can be a value from 1 to 4.
- degree
-
number
The gradient degree. Can be a value from 0.0 (dark) to 1.0 (light).
Returns
void
Remarks
setOneColorGradient(style, variant, degree)
Sets the fill to a one-color gradient.
setOneColorGradient(style: "Mixed" | "Horizontal" | "Vertical" | "DiagonalUp" | "DiagonalDown" | "FromCorner" | "FromTitle" | "FromCenter", variant: number, degree: number): void;
Parameters
- style
-
"Mixed" | "Horizontal" | "Vertical" | "DiagonalUp" | "DiagonalDown" | "FromCorner" | "FromTitle" | "FromCenter"
The gradient style.
- variant
-
number
The gradient variant. Can be a value from 1 to 4.
- degree
-
number
The gradient degree. Can be a value from 0.0 (dark) to 1.0 (light).
Returns
void
Remarks
setPatterned(pattern)
Sets the fill to a pattern.
setPatterned(pattern: Word.PatternType): void;
Parameters
- pattern
- Word.PatternType
Returns
void
Remarks
setPatterned(pattern)
Sets the fill to a pattern.
setPatterned(pattern: "Mixed" | "Percent5" | "Percent10" | "Percent20" | "Percent25" | "Percent30" | "Percent40" | "Percent50" | "Percent60" | "Percent70" | "Percent75" | "Percent80" | "Percent90" | "DarkHorizontal" | "DarkVertical" | "DarkDownwardDiagonal" | "DarkUpwardDiagonal" | "SmallCheckerBoard" | "Trellis" | "LightHorizontal" | "LightVertical" | "LightDownwardDiagonal" | "LightUpwardDiagonal" | "SmallGrid" | "DottedDiamond" | "WideDownwardDiagonal" | "WideUpwardDiagonal" | "DashedUpwardDiagonal" | "DashedDownwardDiagonal" | "NarrowVertical" | "NarrowHorizontal" | "DashedVertical" | "DashedHorizontal" | "LargeConfetti" | "LargeGrid" | "HorizontalBrick" | "LargeCheckerBoard" | "SmallConfetti" | "ZigZag" | "SolidDiamond" | "DiagonalBrick" | "OutlinedDiamond" | "Plaid" | "Sphere" | "Weave" | "DottedGrid" | "Divot" | "Shingle" | "Wave" | "Horizontal" | "Vertical" | "Cross" | "DownwardDiagonal" | "UpwardDiagonal" | "DiagonalCross"): void;
Parameters
- pattern
-
"Mixed" | "Percent5" | "Percent10" | "Percent20" | "Percent25" | "Percent30" | "Percent40" | "Percent50" | "Percent60" | "Percent70" | "Percent75" | "Percent80" | "Percent90" | "DarkHorizontal" | "DarkVertical" | "DarkDownwardDiagonal" | "DarkUpwardDiagonal" | "SmallCheckerBoard" | "Trellis" | "LightHorizontal" | "LightVertical" | "LightDownwardDiagonal" | "LightUpwardDiagonal" | "SmallGrid" | "DottedDiamond" | "WideDownwardDiagonal" | "WideUpwardDiagonal" | "DashedUpwardDiagonal" | "DashedDownwardDiagonal" | "NarrowVertical" | "NarrowHorizontal" | "DashedVertical" | "DashedHorizontal" | "LargeConfetti" | "LargeGrid" | "HorizontalBrick" | "LargeCheckerBoard" | "SmallConfetti" | "ZigZag" | "SolidDiamond" | "DiagonalBrick" | "OutlinedDiamond" | "Plaid" | "Sphere" | "Weave" | "DottedGrid" | "Divot" | "Shingle" | "Wave" | "Horizontal" | "Vertical" | "Cross" | "DownwardDiagonal" | "UpwardDiagonal" | "DiagonalCross"
Returns
void
Remarks
setPresetGradient(style, variant, presetGradientType)
Sets the fill to a preset gradient. The gradient style.The gradient variant. Can be a value from 1 to 4.The preset gradient type.
setPresetGradient(style: Word.GradientStyle, variant: number, presetGradientType: Word.PresetGradientType): void;
Parameters
- style
- Word.GradientStyle
- variant
-
number
- presetGradientType
- Word.PresetGradientType
Returns
void
Remarks
setPresetGradient(style, variant, presetGradientType)
Sets the fill to a preset gradient. The gradient style.The gradient variant. Can be a value from 1 to 4.The preset gradient type.
setPresetGradient(style: "Mixed" | "Horizontal" | "Vertical" | "DiagonalUp" | "DiagonalDown" | "FromCorner" | "FromTitle" | "FromCenter", variant: number, presetGradientType: "Mixed" | "EarlySunset" | "LateSunset" | "Nightfall" | "Daybreak" | "Horizon" | "Desert" | "Ocean" | "CalmWater" | "Fire" | "Fog" | "Moss" | "Peacock" | "Wheat" | "Parchment" | "Mahogany" | "Rainbow" | "RainbowII" | "Gold" | "GoldII" | "Brass" | "Chrome" | "ChromeII" | "Silver" | "Sapphire"): void;
Parameters
- style
-
"Mixed" | "Horizontal" | "Vertical" | "DiagonalUp" | "DiagonalDown" | "FromCorner" | "FromTitle" | "FromCenter"
- variant
-
number
- presetGradientType
-
"Mixed" | "EarlySunset" | "LateSunset" | "Nightfall" | "Daybreak" | "Horizon" | "Desert" | "Ocean" | "CalmWater" | "Fire" | "Fog" | "Moss" | "Peacock" | "Wheat" | "Parchment" | "Mahogany" | "Rainbow" | "RainbowII" | "Gold" | "GoldII" | "Brass" | "Chrome" | "ChromeII" | "Silver" | "Sapphire"
Returns
void
Remarks
setPresetTextured(presetTexture)
Sets the fill to a preset texture.
setPresetTextured(presetTexture: Word.PresetTexture): void;
Parameters
- presetTexture
- Word.PresetTexture
Returns
void
Remarks
setPresetTextured(presetTexture)
Sets the fill to a preset texture.
setPresetTextured(presetTexture: "Mixed" | "Papyrus" | "Canvas" | "Denim" | "WovenMat" | "WaterDroplets" | "PaperBag" | "FishFossil" | "Sand" | "GreenMarble" | "WhiteMarble" | "BrownMarble" | "Granite" | "Newsprint" | "RecycledPaper" | "Parchment" | "Stationery" | "BlueTissuePaper" | "PinkTissuePaper" | "PurpleMesh" | "Bouquet" | "Cork" | "Walnut" | "Oak" | "MediumWood"): void;
Parameters
- presetTexture
-
"Mixed" | "Papyrus" | "Canvas" | "Denim" | "WovenMat" | "WaterDroplets" | "PaperBag" | "FishFossil" | "Sand" | "GreenMarble" | "WhiteMarble" | "BrownMarble" | "Granite" | "Newsprint" | "RecycledPaper" | "Parchment" | "Stationery" | "BlueTissuePaper" | "PinkTissuePaper" | "PurpleMesh" | "Bouquet" | "Cork" | "Walnut" | "Oak" | "MediumWood"
Returns
void
Remarks
setTwoColorGradient(style, variant)
Sets the fill to a two-color gradient.
setTwoColorGradient(style: Word.GradientStyle, variant: number): void;
Parameters
- style
- Word.GradientStyle
- variant
-
number
Returns
void
Remarks
setTwoColorGradient(style, variant)
Sets the fill to a two-color gradient.
setTwoColorGradient(style: "Mixed" | "Horizontal" | "Vertical" | "DiagonalUp" | "DiagonalDown" | "FromCorner" | "FromTitle" | "FromCenter", variant: number): void;
Parameters
- style
-
"Mixed" | "Horizontal" | "Vertical" | "DiagonalUp" | "DiagonalDown" | "FromCorner" | "FromTitle" | "FromCenter"
- variant
-
number
Returns
void
Remarks
solid()
Sets the fill to a uniform color.
solid(): void;
Returns
void
Remarks
toJSON()
Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that's passed to it.) Whereas the original Word.FillFormat object is an API object, the toJSON method returns a plain JavaScript object (typed as Word.Interfaces.FillFormatData) that contains shallow copies of any loaded child properties from the original object.
toJSON(): Word.Interfaces.FillFormatData;
Returns
track()
Track the object for automatic adjustment based on surrounding changes in the document. This call is a shorthand for context.trackedObjects.add(thisObject). If you're using this object across .sync calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you need to add the object to the tracked object collection when the object was first created. If this object is part of a collection, you should also track the parent collection.
track(): Word.FillFormat;
Returns
untrack()
Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You'll need to call context.sync() before the memory release takes effect.
untrack(): Word.FillFormat;