---
title: "TextRun"
url: "https://reference.aspose.com/note/es/java/com.aspose.note/textrun/"
product: "Referencia de API de Aspose.Note para Java"
description: "La clase que representa una pieza de texto con estilo asociado."
---


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

La clase que representa una pieza de texto con estilo asociado.
## Constructores

| Constructor | Descripción |
| --- | --- |
| [TextRun(String text, TextStyle style)](#TextRun-java.lang.String-com.aspose.note.TextStyle-) | Inicializa una nueva instancia de la clase [TextRun](../../com.aspose.note/textrun). |
| [TextRun(String text)](#TextRun-java.lang.String-) | Inicializa una nueva instancia de la clase [TextRun](../../com.aspose.note/textrun) con estilo predeterminado. |
| [TextRun(TextStyle style)](#TextRun-com.aspose.note.TextStyle-) | Inicializa una nueva instancia de la clase [TextRun](../../com.aspose.note/textrun) con texto vacío. |
| [TextRun()](#TextRun--) | Inicializa una nueva instancia de la clase [TextRun](../../com.aspose.note/textrun) con texto vacío y estilo predeterminado. |
## Métodos

| Método | Descripción |
| --- | --- |
| [getLength()](#getLength--) | Obtiene la longitud del texto asociado. |
| [getStyle()](#getStyle--) | Obtiene el estilo. |
| [getText()](#getText--) | Obtiene el texto. |
| [setStyle(TextStyle value)](#setStyle-com.aspose.note.TextStyle-) | Establece el estilo. |
| [setText(String value)](#setText-java.lang.String-) | Establece el texto. |
### TextRun(String text, TextStyle style) {#TextRun-java.lang.String-com.aspose.note.TextStyle-}
```
public TextRun(String text, TextStyle style)
```


Inicializa una nueva instancia de la clase [TextRun](../../com.aspose.note/textrun).

**Parameters:**
| Parámetro | Tipo | Descripción |
| --- | --- | --- |
| texto | java.lang.String | El texto asociado. |
| style | [TextStyle](../../com.aspose.note/textstyle) | El estilo. |

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


Inicializa una nueva instancia de la clase [TextRun](../../com.aspose.note/textrun) con estilo predeterminado.

**Parameters:**
| Parámetro | Tipo | Descripción |
| --- | --- | --- |
| texto | java.lang.String | El texto asociado. |

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


Inicializa una nueva instancia de la clase [TextRun](../../com.aspose.note/textrun) con texto vacío.

**Parameters:**
| Parámetro | Tipo | Descripción |
| --- | --- | --- |
| style | [TextStyle](../../com.aspose.note/textstyle) | El estilo. |

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


Inicializa una nueva instancia de la clase [TextRun](../../com.aspose.note/textrun) con texto vacío y estilo predeterminado.

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


Obtiene la longitud del texto asociado.

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


Obtiene el estilo.

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


Obtiene el texto.

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


Establece el estilo.

**Parameters:**
| Parámetro | Tipo | Descripción |
| --- | --- | --- |
| value | [TextStyle](../../com.aspose.note/textstyle) |  |

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


Establece el texto.

**Parameters:**
| Parámetro | Tipo | Descripción |
| --- | --- | --- |
| valor | java.lang.String |  |

