Skip to main content

Word.Style

Word.Style is an object type of the Word module (Office.word(iframe)). 3 methods.

Remarks​

Methods​

MethodDescription
getResolvedStyle()Returns the final style information including formatting inherited from parent styles.
getStyle()Returns the information and formatting defined directly on this style.
update(changes)Partially updates the formatting defined in the style.

Method details​

getResolvedStyle()​

Returns the final style information including formatting inherited from parent styles. - Returned in the same shape as getStyle(), with formatting inheritance via basedOn applied.

getResolvedStyle(): Promise<(StyleInfo & { textFormat?: TextFormat, paragraphFormat?: ParagraphFormat }) | null>;

Returns

Promise<(StyleInfo & { textFormat?: TextFormat, paragraphFormat?: ParagraphFormat }) | null> - null if none

getStyle()​

Returns the information and formatting defined directly on this style.
Formatting from parent styles linked via basedOn is not included.
textFormat and paragraphFormat can be reused to set text and paragraph formatting respectively. Character styles have no paragraphFormat.

getStyle(): Promise<(StyleInfo & { textFormat?: TextFormat, paragraphFormat?: ParagraphFormat }) | null>;

Returns

Promise<(StyleInfo & { textFormat?: TextFormat, paragraphFormat?: ParagraphFormat }) | null> - null if none

update(changes)​

Partially updates the formatting defined in the style.
Only the specified fields are changed; the rest are kept. null removes the property so the parent style's formatting applies.
Paragraph styles accept both text and paragraph formatting; character styles accept text formatting only.

update(changes: { textFormat?: TextFormat; paragraphFormat?: ParagraphFormat }): Promise<void>;

Parameters

NameTypeDescription
changes{ textFormat?: TextFormat; paragraphFormat?: ParagraphFormat }formatting to change (partial, at least one)

Returns

none