---
title: "IStyleHandler | Customer's Canvas On-Premises"
canonical: "https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IStyleHandler/"
---

# IStyleHandler

> Handler for performing simple operations with paragraph and character styles.

## Interfaces

### IStyleHandler

#### Properties

##### styleChangeEvent

```ts
styleChangeEvent: EventObject<void>;
```

Character or paragraph style change event.

#### Methods

##### clearFormatForCurrentPosition()

```ts
clearFormatForCurrentPosition(): void;
```

Clears the character style for the current cursor position.

###### Returns

`void`

##### clearFormatForRange()

```ts
clearFormatForRange(range): void;
```

Clears the character style for the text range.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `range` | [`ITextRange`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ITextRange.md#itextrange) | text range. |

###### Returns

`void`

##### getCharStyleForCurrentPosition()

```ts
getCharStyleForCurrentPosition(): ICharStyle;
```

Returns the character style for the current cursor position.

###### Returns

[`ICharStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ICharStyle.md#icharstyle)

##### getCharStyleForPosition()

```ts
getCharStyleForPosition(position): ICharStyle;
```

Returns the character style by position.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `position` | [`IPositionInText`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IPositionInText.md#ipositionintext) | position in text. |

###### Returns

[`ICharStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ICharStyle.md#icharstyle)

##### getCharStyleForRange()

```ts
getCharStyleForRange(range): ICharStyle;
```

Returns the character style for a text range.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `range` | [`ITextRange`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ITextRange.md#itextrange) | text range. |

###### Returns

[`ICharStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ICharStyle.md#icharstyle)

##### getDefaultCharStyle()

```ts
getDefaultCharStyle(): ICharStyle;
```

Returns the default character style.

###### Returns

[`ICharStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ICharStyle.md#icharstyle)

##### getDefaultParagraphStyle()

```ts
getDefaultParagraphStyle(): IParagraphStyle;
```

Returns the default paragraph style.

###### Returns

[`IParagraphStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IParagraphStyle.md#iparagraphstyle)

##### getParagraphStyleByIndex()

```ts
getParagraphStyleByIndex(index): IParagraphStyle;
```

Returns the paragraph style by index.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `index` | `number` | paragraph index (from 0). |

###### Returns

[`IParagraphStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IParagraphStyle.md#iparagraphstyle)

##### getParagraphStyleForCurrentPosition()

```ts
getParagraphStyleForCurrentPosition(): IParagraphStyle;
```

Returns the paragraph style for the current cursor position.

###### Returns

[`IParagraphStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IParagraphStyle.md#iparagraphstyle)

##### getParagraphStyleForRange()

```ts
getParagraphStyleForRange(range): IParagraphStyle;
```

Returns the paragraph style for a text range.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `range` | [`ITextRange`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ITextRange.md#itextrange) | text range. |

###### Returns

[`IParagraphStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IParagraphStyle.md#iparagraphstyle)

##### setCharStyleForCurrentPosition()

```ts
setCharStyleForCurrentPosition(style): void;
```

Sets the character style for the current cursor position (patch).

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `style` | [`ICharStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ICharStyle.md#icharstyle) | expected character style. |

###### Returns

`void`

###### Remarks

Only those properties that are specified in expected style are set.

##### setCharStyleForPosition()

```ts
setCharStyleForPosition(position, style): void;
```

Sets the character style by position.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `position` | [`IPositionInText`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IPositionInText.md#ipositionintext) | position in text. |
| `style` | [`ICharStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ICharStyle.md#icharstyle) | character style. |

###### Returns

`void`

###### Remarks

Only those properties that are specified in expected style are set.

##### setCharStyleForRange()

```ts
setCharStyleForRange(style, range): void;
```

Sets the character style for a text range (patch).

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `style` | [`ICharStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ICharStyle.md#icharstyle) | character style. |
| `range` | [`ITextRange`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ITextRange.md#itextrange) | text range. |

###### Returns

`void`

###### Remarks

Only those properties that are specified in expected style are set.

##### setDefaultCharStyle()

```ts
setDefaultCharStyle(style): void;
```

Sets the default character style.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `style` | [`ICharStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ICharStyle.md#icharstyle) | character style. |

###### Returns

`void`

##### setDefaultParagraphStyle()

```ts
setDefaultParagraphStyle(style): void;
```

Sets the default paragraph style.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `style` | [`IParagraphStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IParagraphStyle.md#iparagraphstyle) | paragraph style. |

###### Returns

`void`

##### setParagraphStyleByIndex()

```ts
setParagraphStyleByIndex(index, style): void;
```

Sets the paragraph style for the current cursor position (patch).

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `index` | `number` | paragraph index (from 0). |
| `style` | [`IParagraphStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IParagraphStyle.md#iparagraphstyle) | expected paragraph style. |

###### Returns

`void`

##### setParagraphStyleForCurrentPosition()

```ts
setParagraphStyleForCurrentPosition(style): void;
```

Sets the paragraph style for the current cursor position (patch).

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `style` | [`IParagraphStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IParagraphStyle.md#iparagraphstyle) | expected paragraph style. |

###### Returns

`void`

###### Remarks

Only those properties that are specified in expected style are set.

##### setParagraphStyleForRange()

```ts
setParagraphStyleForRange(style, range): void;
```

Sets the paragraph style for a text range (patch).

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `style` | [`IParagraphStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IParagraphStyle.md#iparagraphstyle) | paragraph style. |
| `range` | [`ITextRange`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ITextRange.md#itextrange) | text range. |

###### Returns

`void`

###### Remarks

Only those properties that are specified in expected style are set.
