@univerjscoreclassesTextstylevalue

@univerjs/core v0.5.4


Class: TextStyleValue

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

Represents a read-only font style value object. This class provides access to font style properties without modification capabilities.

Extended by

Constructors

new TextStyleValue()

new TextStyleValue(style): TextStyleValue

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

Creates a new TextStyleValue instance

Parameters

ParameterTypeDescription
styleITextStyleThe initial style object

Returns

TextStyleValue

Example

const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style);

Properties

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

Accessors

background

Get Signature

get background(): Nullable<IColorStyle>

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

Gets the background color

Example
const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.background);
Returns

Nullable<IColorStyle>

The background color or null/undefined


bold

Get Signature

get bold(): boolean

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

Gets whether the text is bold

Example
const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.bold);
Returns

boolean

True if bold, false otherwise


border

Get Signature

get border(): Nullable<IBorderData>

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

Gets the border settings

Example
const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.border);
Returns

Nullable<IBorderData>

The border settings or null/undefined


bottomBorderLine

Get Signature

get bottomBorderLine(): undefined | TextDecorationBuilder

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

Gets the bottom border line decoration

Example
const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.bottomBorderLine);
Returns

undefined | TextDecorationBuilder

The bottom border line decoration or undefined


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:200

Gets the text color

Example
const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.color);
Returns

Nullable<IColorStyle>

The text color or null/undefined


fontFamily

Get Signature

get fontFamily(): Nullable<string>

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

Gets the font family

Example
const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.fontFamily);
Returns

Nullable<string>

The font family name or undefined


fontSize

Get Signature

get fontSize(): undefined | number

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

Gets the font size in points

Example
const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.fontSize);
Returns

undefined | number

The font size or undefined


italic

Get Signature

get italic(): boolean

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

Gets whether the text is italic

Example
const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.italic);
Returns

boolean

True if italic, false otherwise


numberFormat

Get Signature

get numberFormat(): Nullable<{
  pattern: string;
}>

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

Gets the number format pattern

Example
const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.numberFormat);
Returns

Nullable<{ pattern: string; }>

The number format pattern or null/undefined


overline

Get Signature

get overline(): undefined | TextDecorationBuilder

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

Gets the overline decoration

Example
const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.overline);
Returns

undefined | TextDecorationBuilder

The overline decoration or undefined


strikethrough

Get Signature

get strikethrough(): undefined | TextDecorationBuilder

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

Gets the strikethrough decoration

Example
const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.strikethrough);
Returns

undefined | TextDecorationBuilder

The strikethrough decoration or undefined


underline

Get Signature

get underline(): undefined | TextDecorationBuilder

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

Gets the underline decoration

Example
const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.underline);
Returns

undefined | TextDecorationBuilder

The underline decoration or undefined


verticalAlign

Get Signature

get verticalAlign(): Nullable<BaselineOffset>

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

Gets the vertical alignment (subscript/superscript)

Example
const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.verticalAlign);
Returns

Nullable<BaselineOffset>

The vertical alignment or null/undefined

Methods

copy()

copy(): TextStyleBuilder

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

Creates a copy of this font style as a builder

Returns

TextStyleBuilder

A new TextStyleBuilder instance with the same style

Example

const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
const copy = style.copy();
console.log(copy);

getValue()

getValue(): ITextStyle

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

Gets the raw style object

Returns

ITextStyle

The underlying style object

Example

const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style.getValue());

create()

static create(style): TextStyleValue

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

Creates an instance of TextStyleValue.

Parameters

ParameterTypeDescription
styleITextStylestyle object

Returns

TextStyleValue

font style instance

Example

const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
console.log(style);