TextStyle

The rendered style of text in a cell.

Text styles can have a corresponding `https://developers.google.com/apps-script/reference/spreadsheet/rich-text-value`. If the `https://developers.google.com/apps-script/reference/spreadsheet/rich-text-value` 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 `https://developers.google.com/apps-script/reference/spreadsheet/rich-text-value#getRuns()` method.

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/spreadsheet/text-style#copy()` | `https://developers.google.com/apps-script/reference/spreadsheet/text-style-builder` | Creates a text style builder initialized with the values of this text style. |
| `https://developers.google.com/apps-script/reference/spreadsheet/text-style#getFontFamily()` | `String` | Gets the font family of the text. |
| `https://developers.google.com/apps-script/reference/spreadsheet/text-style#getFontSize()` | `Integer` | Gets the font size of the text in points. |
| `https://developers.google.com/apps-script/reference/spreadsheet/text-style#getForegroundColorObject()` | `https://developers.google.com/apps-script/reference/spreadsheet/color|null` | Gets the font color of the text. |
| `https://developers.google.com/apps-script/reference/spreadsheet/text-style#isBold()` | `Boolean` | Gets whether or not the text is bold. |
| `https://developers.google.com/apps-script/reference/spreadsheet/text-style#isItalic()` | `Boolean` | Gets whether or not the cell is italic. |
| `https://developers.google.com/apps-script/reference/spreadsheet/text-style#isStrikethrough()` | `Boolean` | Gets whether or not the cell has strikethrough. |
| `https://developers.google.com/apps-script/reference/spreadsheet/text-style#isUnderline()` | `Boolean` | Gets whether or not the cell is underlined. |

### Deprecated methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/spreadsheet/text-style#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


`https://developers.google.com/apps-script/reference/spreadsheet/text-style-builder` --- 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 `https://developers.google.com/apps-script/reference/spreadsheet/rich-text-value` 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 `https://developers.google.com/apps-script/reference/spreadsheet/rich-text-value` 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 `https://developers.google.com/apps-script/reference/spreadsheet/rich-text-value` has multiple runs with different font
colors.

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/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 `https://developers.google.com/apps-script/reference/spreadsheet/rich-text-value` 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 `https://developers.google.com/apps-script/reference/spreadsheet/rich-text-value` 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 `https://developers.google.com/apps-script/reference/spreadsheet/rich-text-value` 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 `https://developers.google.com/apps-script/reference/spreadsheet/rich-text-value` has multiple runs with different underline
settings.

#### Return


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

## Deprecated methods

### `getForegroundColor()`


**Deprecated.** Replaced by `https://developers.google.com/apps-script/reference/spreadsheet/text-style#getForegroundColorObject()`

Gets the font color of the text. Returns `null` if the font color isn't set or the
corresponding `https://developers.google.com/apps-script/reference/spreadsheet/rich-text-value` 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`.