Edit

Share via


Word.ConditionalStyle class

Represents special formatting applied to specified areas of a table when the selected table is formatted with a specified table style.

Extends

Remarks

[ API set: WordApiDesktop 1.4 ]

Properties

borders

Returns a BorderUniversalCollection object that represents all the borders for the conditional style.

bottomPadding

Specifies the amount of space (in points) to add below the contents of a single cell or all the cells in a table.

context

The request context associated with the object. This connects the add-in's process to the Office host application's process.

font

Returns a Font object that represents the font formatting for the conditional style.

leftPadding

Specifies the amount of space (in points) to add to the left of the contents of a single cell or all the cells in a table.

paragraphFormat

Returns a ParagraphFormat object that represents the paragraph formatting for the conditional style.

rightPadding

Specifies the amount of space (in points) to add to the right of the contents of a single cell or all the cells in a table.

shading

Returns a ShadingUniversal object that represents the shading of the conditional style.

topPadding

Specifies the amount of space (in points) to add above the contents of a single cell or all the cells in a table.

Methods

load(options)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNames)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNamesAndPaths)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

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.ConditionalStyle object is an API object, the toJSON method returns a plain JavaScript object (typed as Word.Interfaces.ConditionalStyleData) that contains shallow copies of any loaded child properties from the original object.

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.

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.

Property Details

borders

Returns a BorderUniversalCollection object that represents all the borders for the conditional style.

readonly borders: Word.BorderUniversalCollection;

Property Value

Remarks

[ API set: WordApiDesktop 1.4 ]

bottomPadding

Specifies the amount of space (in points) to add below the contents of a single cell or all the cells in a table.

bottomPadding: number;

Property Value

number

Remarks

[ API set: WordApiDesktop 1.4 ]

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

font

Returns a Font object that represents the font formatting for the conditional style.

readonly font: Word.Font;

Property Value

Remarks

[ API set: WordApiDesktop 1.4 ]

leftPadding

Specifies the amount of space (in points) to add to the left of the contents of a single cell or all the cells in a table.

leftPadding: number;

Property Value

number

Remarks

[ API set: WordApiDesktop 1.4 ]

paragraphFormat

Returns a ParagraphFormat object that represents the paragraph formatting for the conditional style.

readonly paragraphFormat: Word.ParagraphFormat;

Property Value

Remarks

[ API set: WordApiDesktop 1.4 ]

rightPadding

Specifies the amount of space (in points) to add to the right of the contents of a single cell or all the cells in a table.

rightPadding: number;

Property Value

number

Remarks

[ API set: WordApiDesktop 1.4 ]

shading

Returns a ShadingUniversal object that represents the shading of the conditional style.

readonly shading: Word.ShadingUniversal;

Property Value

Remarks

[ API set: WordApiDesktop 1.4 ]

topPadding

Specifies the amount of space (in points) to add above the contents of a single cell or all the cells in a table.

topPadding: number;

Property Value

number

Remarks

[ API set: WordApiDesktop 1.4 ]

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.ConditionalStyleLoadOptions): Word.ConditionalStyle;

Parameters

options
Word.Interfaces.ConditionalStyleLoadOptions

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.ConditionalStyle;

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.ConditionalStyle;

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

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.ConditionalStyle object is an API object, the toJSON method returns a plain JavaScript object (typed as Word.Interfaces.ConditionalStyleData) that contains shallow copies of any loaded child properties from the original object.

toJSON(): Word.Interfaces.ConditionalStyleData;

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.ConditionalStyle;

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.ConditionalStyle;

Returns