
**Inheritance:**
java.lang.Object
```
public class TextRun
```

The class representing a piece of text with associated style.
## Constructors

| Constructor | Description |
| --- | --- |
| [TextRun(String text, TextStyle style)](#TextRun-java.lang.String-com.aspose.note.TextStyle-) | Initializes a new instance of the [TextRun](../../com.aspose.note/textrun) class. |
| [TextRun(String text)](#TextRun-java.lang.String-) | Initializes a new instance of the [TextRun](../../com.aspose.note/textrun) class with default style. |
| [TextRun(TextStyle style)](#TextRun-com.aspose.note.TextStyle-) | Initializes a new instance of the [TextRun](../../com.aspose.note/textrun) class with empty text. |
| [TextRun()](#TextRun--) | Initializes a new instance of the [TextRun](../../com.aspose.note/textrun) class with empty text and default style. |
## Methods

| Method | Description |
| --- | --- |
| [getLength()](#getLength--) | Gets the length of the associated text. |
| [getStyle()](#getStyle--) | Gets the style. |
| [getText()](#getText--) | Gets the text. |
| [setStyle(TextStyle value)](#setStyle-com.aspose.note.TextStyle-) | Sets the style. |
| [setText(String value)](#setText-java.lang.String-) | Sets the text. |
### TextRun(String text, TextStyle style) {#TextRun-java.lang.String-com.aspose.note.TextStyle-}
```
public TextRun(String text, TextStyle style)
```


Initializes a new instance of the [TextRun](../../com.aspose.note/textrun) class.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| text | java.lang.String | The associated text. |
| style | [TextStyle](../../com.aspose.note/textstyle) | The style. |

### TextRun(String text) {#TextRun-java.lang.String-}
```
public TextRun(String text)
```


Initializes a new instance of the [TextRun](../../com.aspose.note/textrun) class with default style.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| text | java.lang.String | The associated text. |

### TextRun(TextStyle style) {#TextRun-com.aspose.note.TextStyle-}
```
public TextRun(TextStyle style)
```


Initializes a new instance of the [TextRun](../../com.aspose.note/textrun) class with empty text.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| style | [TextStyle](../../com.aspose.note/textstyle) | The style. |

### TextRun() {#TextRun--}
```
public TextRun()
```


Initializes a new instance of the [TextRun](../../com.aspose.note/textrun) class with empty text and default style.

### getLength() {#getLength--}
```
public final int getLength()
```


Gets the length of the associated text.

**Returns:**
int
### getStyle() {#getStyle--}
```
public final TextStyle getStyle()
```


Gets the style.

**Returns:**
[TextStyle](../../com.aspose.note/textstyle)
### getText() {#getText--}
```
public final String getText()
```


Gets the text.

**Returns:**
java.lang.String
### setStyle(TextStyle value) {#setStyle-com.aspose.note.TextStyle-}
```
public final void setStyle(TextStyle value)
```


Sets the style.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | [TextStyle](../../com.aspose.note/textstyle) |  |

### setText(String value) {#setText-java.lang.String-}
```
public final void setText(String value)
```


Sets the text.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | java.lang.String |  |

