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

# IStyleService

> Service for performing basic operations with paragraph and character styles.

## Interfaces

### IStyleService

#### Extended by

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

#### Properties

##### styleChangedEvent

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

Character or paragraph style change event.

#### Methods

##### clearCurrentFormatting()

```ts
clearCurrentFormatting(): void;
```

Clears formatting (character style) for the current cursor position or selected text.

###### Returns

`void`

##### 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)

##### getCurrentCharStyle()

```ts
getCurrentCharStyle(): ICharStyle;
```

Returns the character style for the current cursor position or the starting position of the selected text.

###### Returns

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

##### getCurrentParagraphStyle()

```ts
getCurrentParagraphStyle(): IParagraphStyle;
```

Returns the paragraph style for the current cursor position or the first paragraph of the selected text.

###### 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)

##### 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) | expected character style. |

###### Returns

`void`

##### setCurrentCharStyle()

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

Sets the character style for the current cursor position or selected text.

###### 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 properties specified in the expected style are set.

##### setCurrentParagraphStyle()

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

Sets the paragraph style for the current cursor position or selected text.

###### 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 properties specified in the expected style are set.

##### setParagraphStyleByIndex()

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

Sets the paragraph style by index.

###### 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`

###### Remarks

only properties specified in the expected style are set.
