@univerjscoreclassesTextdecorationbuilder

@univerjs/core v0.5.4


Class: TextDecorationBuilder

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:467

Builder class for creating and modifying text decorations. Provides a fluent interface for setting text decoration properties.

Constructors

new TextDecorationBuilder()

new TextDecorationBuilder(decoration): TextDecorationBuilder

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:492

Creates a new TextDecorationBuilder instance

Parameters

ParameterTypeDescription
decorationITextDecorationThe initial decoration object

Returns

TextDecorationBuilder

Example

const decoration = new TextDecorationBuilder({ s: 1, t: TextDecoration.SINGLE });

Properties

PropertyModifierTypeDefined in
_decorationprotectedITextDecorationpackages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:468

Accessors

color

Get Signature

get color(): Nullable<IColorStyle>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:516

Gets the decoration color

Returns

Nullable<IColorStyle>

The decoration color


followFontColor

Get Signature

get followFontColor(): boolean

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:508

Gets whether the decoration color follows the font color

Returns

boolean

True if the decoration color follows the font color


show

Get Signature

get show(): boolean

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:500

Gets whether the decoration is shown

Returns

boolean

True if the decoration is shown


type

Get Signature

get type(): Nullable<TextDecoration>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:524

Gets the decoration line type

Returns

Nullable<TextDecoration>

The decoration line type

Methods

build()

build(): ITextDecoration

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:604

Builds and returns the final decoration object

Returns

ITextDecoration

The complete text decoration object

Example

const style = decoration.build();

copy()

copy(): TextDecorationBuilder

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:592

Creates a copy of this text decoration builder

Returns

TextDecorationBuilder

A new TextDecorationBuilder instance with the same decoration

Example

const copy = decoration.copy();

setColor()

setColor(color): TextDecorationBuilder

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:565

Sets the decoration color

Parameters

ParameterTypeDescription
colorIColorStyleThe color style

Returns

TextDecorationBuilder

The builder instance for chaining

Example

decoration.setColor({ rgb: '#FF0000' });

setFollowFontColor()

setFollowFontColor(value): TextDecorationBuilder

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:551

Sets whether the decoration color follows the font color

Parameters

ParameterTypeDescription
valuebooleanTrue to follow font color

Returns

TextDecorationBuilder

The builder instance for chaining

Example

decoration.setFollowFontColor(false);

setLineType()

setLineType(type): TextDecorationBuilder

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:579

Sets the decoration line type

Parameters

ParameterTypeDescription
typeTextDecorationThe line type

Returns

TextDecorationBuilder

The builder instance for chaining

Example

decoration.setLineType(TextDecoration.SINGLE);

setShow()

setShow(value): TextDecorationBuilder

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:537

Sets whether the decoration is shown

Parameters

ParameterTypeDescription
valuebooleanTrue to show the decoration

Returns

TextDecorationBuilder

The builder instance for chaining

Example

decoration.setShow(true);

create()

static create(decoration): TextDecorationBuilder

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/rich-text-builder.ts:480

Creates an instance of TextDecorationBuilder.

Parameters

ParameterTypeDescription
decorationITextDecorationInitial decoration object

Returns

TextDecorationBuilder

text decoration builder instance

Example

const decoration = TextDecorationBuilder.create({ s: 1, t: TextDecoration.SINGLE });
console.log(decoration);