# Class TextStyle

TextStyle

The rendered style of text in a cell.

Text styles can have a corresponding `RichTextValue`. If the `RichTextValue` spans multiple text runs that have different values for a given text style read
method, the method returns `null`. To avoid this, query for text styles using the Rich Text
values returned by the `RichTextValue.getRuns()` method.

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `copy()` | `TextStyleBuilder` | Creates a text style builder initialized with the values of this text style. |
| `getFontFamily()` | `String` | Gets the font family of the text. |
| `getFontSize()` | `Integer` | Gets the font size of the text in points. |
| `getForegroundColorObject()` | `Color|null` | Gets the font color of the text. |
| `isBold()` | `Boolean` | Gets whether or not the text is bold. |
| `isItalic()` | `Boolean` | Gets whether or not the cell is italic. |
| `isStrikethrough()` | `Boolean` | Gets whether or not the cell has strikethrough. |
| `isUnderline()` | `Boolean` | Gets whether or not the cell is underlined. |

### Deprecated methods

| Method | Return type | Brief description |
|---|---|---|
| `getForegroundColor()` | `String|null` | Gets the font color of the text. |

## Detailed documentation

### `copy()`

Creates a text style builder initialized with the values of this text style.

#### Return


`TextStyleBuilder` --- A builder from this text style.

*** ** * ** ***

### `getFontFamily()`

Gets the font family of the text. Returns `null` if the font family isn't set or the
corresponding `RichTextValue` has multiple runs with different font
families.

#### Return


`String` --- The font family of the text (for example, "Arial") or `null`.

*** ** * ** ***

### `getFontSize()`

Gets the font size of the text in points. Returns `null` if the font size isn't set or
the corresponding `RichTextValue` has multiple runs with different font
sizes.

#### Return


`Integer` --- The font size of the text or `null`.

*** ** * ** ***

### `getForegroundColorObject()`

Gets the font color of the text. Returns `null` if the font color isn't set or the
corresponding `RichTextValue` has multiple runs with different font
colors.

#### Return


`Color|null` --- The font color of the text or `null`.

*** ** * ** ***

### `isBold()`

Gets whether or not the text is bold. Returns `null` if bold isn't set or the
corresponding `RichTextValue` has multiple runs with different bold
settings.

#### Return


`Boolean` --- Whether or not the cell is bold, or `null`.

*** ** * ** ***

### `isItalic()`

Gets whether or not the cell is italic. Returns `null` if italic isn't set or the
corresponding `RichTextValue` has multiple runs with different italic
settings.

#### Return


`Boolean` --- Whether or not the cell is italic, or `null`.

*** ** * ** ***

### `isStrikethrough()`

Gets whether or not the cell has strikethrough. Returns `null` if strikethrough isn't set
or the corresponding `RichTextValue` has multiple runs with different
strikethrough settings.

#### Return


`Boolean` --- Whether or not the cell has strikethrough, or `null`.

*** ** * ** ***

### `isUnderline()`

Gets whether or not the cell is underlined. Returns `null` if underline isn't set or the
corresponding `RichTextValue` has multiple runs with different underline
settings.

#### Return


`Boolean` --- Whether or not the cell is underlined, or `null`.

## Deprecated methods

### `getForegroundColor()`


**Deprecated.** Replaced by `getForegroundColorObject()`

Gets the font color of the text. Returns `null` if the font color isn't set or the
corresponding `RichTextValue` has multiple runs with different font
colors.

#### Return


`String|null` --- The font color of the text as a hex CSS value (for example, "#ff0000") or `null`.