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
Parameter | Type | Description |
---|---|---|
decoration | ITextDecoration | The initial decoration object |
Returns
Example
const decoration = new TextDecorationBuilder({ s: 1, t: TextDecoration.SINGLE });
Properties
Property | Modifier | Type | Defined in |
---|---|---|---|
_decoration | protected | ITextDecoration | packages/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
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
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
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
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
Parameter | Type | Description |
---|---|---|
color | IColorStyle | The color style |
Returns
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
Parameter | Type | Description |
---|---|---|
value | boolean | True to follow font color |
Returns
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
Parameter | Type | Description |
---|---|---|
type | TextDecoration | The line type |
Returns
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
Parameter | Type | Description |
---|---|---|
value | boolean | True to show the decoration |
Returns
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
Parameter | Type | Description |
---|---|---|
decoration | ITextDecoration | Initial decoration object |
Returns
text decoration builder instance
Example
const decoration = TextDecorationBuilder.create({ s: 1, t: TextDecoration.SINGLE });
console.log(decoration);