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

# ITextService

> Service for performing basic operations with text content.

## Interfaces

### ITextService

#### Extended by

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

#### Properties

##### textChangedEvent

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

Text content change event.

#### Methods

##### deleteAllText()

```ts
deleteAllText(): void;
```

Deletes all text.

###### Returns

`void`

##### deleteTextByRange()

```ts
deleteTextByRange(textRange): IPositionInText;
```

Deletes text by range

###### Parameters

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

###### Returns

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

##### deleteTextToDirection()

```ts
deleteTextToDirection(direction): void;
```

Deletes the selected text or character relative to the current cursor position.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `direction` | [`MoveDirectionType`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/MoveDirectionType.md#movedirectiontype) | direction of text deletion. |

###### Returns

`void`

##### getFormattedText()

```ts
getFormattedText(): string;
```

Returns formatted text.

###### Returns

`string`

##### getParagraphCount()

```ts
getParagraphCount(): number;
```

Returns paragraph count.

###### Returns

`number`

##### getParagraphText()

```ts
getParagraphText(paragraphIndex): ITextRange;
```

Returns the text range of a paragraph by index.

###### Parameters

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

###### Returns

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

##### getTextModel()

```ts
getTextModel(): Text;
```

Returns the text model.

###### Returns

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

##### getTextRangeByPositions()

```ts
getTextRangeByPositions(startPosition, endPosition): ITextRange;
```

Returns the range of text by starting and ending position.

###### Parameters

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

###### Returns

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

##### insertFormattedText()

```ts
insertFormattedText(text): void;
```

Inserts formatted text relative to the current cursor position.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `text` | `string` | text to insert. |

###### Returns

`void`

##### insertNewLine()

```ts
insertNewLine(): void;
```

Inserts a new line relative to the current cursor position.

###### Returns

`void`

##### insertPlainText()

```ts
insertPlainText(text): void;
```

Inserts plain text relative to the current cursor position.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `text` | `string` | text to insert. |

###### Returns

`void`

##### measureText()

```ts
measureText(scale, isExtendToBlackBox?): RectangleF;
```

Measures text.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `scale` | `number` | scale. |
| `isExtendToBlackBox?` | `boolean` | indicates if extend to black box. |

###### Returns

`RectangleF`

##### measureTextFrames()

```ts
measureTextFrames(useActiveText): RectangleF;
```

Measures the text frame.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `useActiveText` | `boolean` | true if you want to use the currently active text, false if the item's original text. |

###### Returns

`RectangleF`

##### setTextModel()

```ts
setTextModel(model): void;
```

Sets the text model.

###### Parameters

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

###### Returns

`void`

##### setWrappingPath()

```ts
setWrappingPath(data): void;
```

Sets the wrapping path.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `data` | [`IWrappingPathData`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IWrappingPathData.md#iwrappingpathdata) | wrapping path data. |

###### Returns

`void`
