Class RichTextValue
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Valordetexto enriquecido
Es una cadena de texto estilizada que se usa para representar el texto de una celda. Las subcadenas del texto pueden tener diferentes
estilos de texto.
Un grupo es la subcadena más larga sin interrupciones que tiene el mismo estilo de texto. Por ejemplo, la oración "Este niño está cargando manzanas" tiene 4 ejecuciones: ['This ', 'child ',
'is carrying ', 'apples']
.
Documentación detallada
copy()
Muestra un compilador para un valor de texto enriquecido inicializado con los valores de este valor de texto enriquecido.
Volver
RichTextValueBuilder
: Es un compilador para un valor de texto enriquecido.
getEndIndex()
Obtiene el índice de finalización de este valor en la celda.
Volver
Integer
: Es el índice de fin de este valor en la celda.
getLinkUrl()
Muestra la URL del vínculo para este valor.
Volver
String
: Es la URL de vínculo para este valor, o null
si no hay un vínculo o si hay varios vínculos diferentes.
getLinkUrl(startOffset, endOffset)
Muestra la URL del vínculo para el texto de startOffset
a endOffset
. Los desplazamientos se basan en 0 y son relativos al texto de la celda, de modo que el desplazamiento inicial es inclusivo y el desplazamiento final es exclusivo.
Parámetros
Nombre | Tipo | Descripción |
startOffset | Integer | Es el desplazamiento inicial. |
endOffset | Integer | Es la compensación final. |
Volver
String
: Es la URL de vínculo para este valor, o null
si no hay ningún vínculo o si hay varios vínculos diferentes en el rango determinado.
getRuns()
Muestra la cadena de texto enriquecido dividida en un array de ejecuciones, en el que cada ejecución es la subcadena más larga posible que tiene un estilo de texto coherente.
Volver
RichTextValue[]
: Es un array de ejecuciones.
getStartIndex()
Obtiene el índice de inicio de este valor en la celda.
Volver
Integer
: Es el índice de inicio de este valor en la celda.
getText()
Muestra el texto de este valor.
Volver
String
: Es el texto de este valor.
getTextStyle()
Muestra el estilo de texto de este valor.
Volver
TextStyle
: Es el estilo de texto de este valor.
getTextStyle(startOffset, endOffset)
Devuelve el estilo de texto del texto de startOffset
a endOffset
. Los desplazamientos se basan en 0 y son relativos al texto de la celda, de modo que el desplazamiento inicial es inclusivo y el desplazamiento final es exclusivo.
Parámetros
Nombre | Tipo | Descripción |
startOffset | Integer | Es el desplazamiento inicial. |
endOffset | Integer | Es la compensación final. |
Volver
TextStyle
: Es el estilo de texto de la subcadena determinada de este valor.
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-26 (UTC)
[null,null,["Última actualización: 2025-07-26 (UTC)"],[[["\u003cp\u003e\u003ccode\u003eRichTextValue\u003c/code\u003e objects represent stylized text within a spreadsheet cell, allowing substrings to have varied styles.\u003c/p\u003e\n"],["\u003cp\u003eText is broken into "runs," which are the longest continuous substrings sharing the same style.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRichTextValue\u003c/code\u003e class provides methods to access and manipulate text, styles, and links within these runs.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can retrieve individual runs, get/set text styles, and extract link URLs using dedicated methods.\u003c/p\u003e\n"],["\u003cp\u003eMethods like \u003ccode\u003ecopy()\u003c/code\u003e, \u003ccode\u003egetText()\u003c/code\u003e, \u003ccode\u003egetRuns()\u003c/code\u003e, and \u003ccode\u003egetTextStyle()\u003c/code\u003e offer manipulation of \u003ccode\u003eRichTextValues\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Class RichTextValue\n\nRichTextValue\n\nA stylized text string used to represent cell text. Substrings of the text can have different\ntext styles.\n\nA *run* is the longest unbroken substring having the same text style. For example, the\nsentence, \"This **child** *is carrying* apples\" has 4 runs: `['This ', 'child ',\n'is carrying ', 'apples']`. \n\n### Methods\n\n| Method | Return type | Brief description |\n|------------------------------------------------------------------------|------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|\n| [copy()](#copy()) | [RichTextValueBuilder](/apps-script/reference/spreadsheet/rich-text-value-builder) | Returns a builder for a Rich Text value initialized with the values of this Rich Text value. |\n| [getEndIndex()](#getEndIndex()) | `Integer` | Gets the end index of this value in the cell. |\n| [getLinkUrl()](#getLinkUrl()) | `String` | Returns the link URL for this value. |\n| [getLinkUrl(startOffset, endOffset)](#getLinkUrl(Integer,Integer)) | `String` | Returns the link URL for the text from `start``Offset` to `end``Offset`. |\n| [getRuns()](#getRuns()) | [RichTextValue[]](#) | Returns the Rich Text string split into an array of runs, wherein each run is the longest possible substring having a consistent text style. |\n| [getStartIndex()](#getStartIndex()) | `Integer` | Gets the start index of this value in the cell. |\n| [getText()](#getText()) | `String` | Returns the text of this value. |\n| [getTextStyle()](#getTextStyle()) | [TextStyle](/apps-script/reference/spreadsheet/text-style) | Returns the text style of this value. |\n| [getTextStyle(startOffset, endOffset)](#getTextStyle(Integer,Integer)) | [TextStyle](/apps-script/reference/spreadsheet/text-style) | Returns the text style of the text from `start``Offset` to `end``Offset`. |\n\nDetailed documentation\n----------------------\n\n### `copy()`\n\nReturns a builder for a Rich Text value initialized with the values of this Rich Text value.\n\n#### Return\n\n\n[RichTextValueBuilder](/apps-script/reference/spreadsheet/rich-text-value-builder) --- A builder for a Rich Text value.\n\n*** ** * ** ***\n\n### `get``End``Index()`\n\nGets the end index of this value in the cell.\n\n#### Return\n\n\n`Integer` --- The end index of this value in the cell.\n\n*** ** * ** ***\n\n### `get``Link``Url()`\n\nReturns the link URL for this value.\n\n#### Return\n\n\n`String` --- The link URL for this value, or `null` if there is no link or if there are\nmultiple different links.\n\n*** ** * ** ***\n\n### `get``Link``Url(startOffset, endOffset)`\n\nReturns the link URL for the text from `start``Offset` to `end``Offset`. Offsets are 0\nbased and relative to the cell's text, with the start offset being inclusive and the end offset\nbeing exclusive.\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------------|-----------|-------------------|\n| `start``Offset` | `Integer` | The start offset. |\n| `end``Offset` | `Integer` | The end offset. |\n\n#### Return\n\n\n`String` --- The link URL for this value, or `null` if there is no link or if multiple\ndifferent links are in the given range.\n\n*** ** * ** ***\n\n### `get``Runs()`\n\nReturns the Rich Text string split into an array of runs, wherein each run is the longest\npossible substring having a consistent text style.\n\n#### Return\n\n\n[RichTextValue[]](#) --- An array of runs.\n\n*** ** * ** ***\n\n### `get``Start``Index()`\n\nGets the start index of this value in the cell.\n\n#### Return\n\n\n`Integer` --- The start index of this value in the cell.\n\n*** ** * ** ***\n\n### `get``Text()`\n\nReturns the text of this value.\n\n#### Return\n\n\n`String` --- The text of this value.\n\n*** ** * ** ***\n\n### `get``Text``Style()`\n\nReturns the text style of this value.\n\n#### Return\n\n\n[TextStyle](/apps-script/reference/spreadsheet/text-style) --- The text style of this value.\n\n*** ** * ** ***\n\n### `get``Text``Style(startOffset, endOffset)`\n\nReturns the text style of the text from `start``Offset` to `end``Offset`. Offsets are 0\nbased and relative to the cell's text, with the start offset being inclusive and the end offset\nbeing exclusive.\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------------|-----------|-------------------|\n| `start``Offset` | `Integer` | The start offset. |\n| `end``Offset` | `Integer` | The end offset. |\n\n#### Return\n\n\n[TextStyle](/apps-script/reference/spreadsheet/text-style) --- The text style of the given substring of this value."]]