Class RichTextValue
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
서식텍스트값
셀 텍스트를 나타내는 데 사용되는 스타일이 지정된 텍스트 문자열입니다. 텍스트의 하위 문자열에는 서로 다른 텍스트 스타일이 있을 수 있습니다.
런은 텍스트 스타일이 동일한 가장 긴 연속 하위 문자열입니다. 예를 들어 '이 아이 가 사과 를 들고 있습니다'라는 문장에는 4개의 실행(['This ', 'child ',
'is carrying ', 'apples']
)이 있습니다.
자세한 문서
getEndIndex()
셀에서 이 값의 종료 색인을 가져옵니다.
리턴
Integer
: 셀에서 이 값의 종료 인덱스입니다.
getLinkUrl()
이 값의 링크 URL을 반환합니다.
리턴
String
: 이 값의 링크 URL입니다. 링크가 없거나 여러 개의 서로 다른 링크가 있는 경우에는 null
입니다.
getLinkUrl(startOffset, endOffset)
텍스트의 링크 URL을 startOffset
에서 endOffset
(으)로 반환합니다. 오프셋은 0을 기준으로 하며 셀의 텍스트를 기준으로 합니다. 시작 오프셋은 시작 텍스트를 포함하고 끝 오프셋은 끝 텍스트를 제외합니다.
매개변수
이름 | 유형 | 설명 |
startOffset | Integer | 시작 오프셋입니다. |
endOffset | Integer | 종료 오프셋입니다. |
리턴
String
: 이 값의 링크 URL입니다. 링크가 없거나 지정된 범위에 여러 개의 서로 다른 링크가 있는 경우 null
입니다.
getRuns()
각 실행이 일관된 텍스트 스타일을 가진 가장 긴 하위 문자열인 실행 배열로 분할된 리치 텍스트 문자열을 반환합니다.
리턴
RichTextValue[]
- 실행의 배열입니다.
getStartIndex()
셀에서 이 값의 시작 색인을 가져옵니다.
리턴
Integer
: 셀에서 이 값의 시작 색인입니다.
getText()
이 값의 텍스트를 반환합니다.
리턴
String
: 이 값의 텍스트입니다.
getTextStyle()
이 값의 텍스트 스타일을 반환합니다.
리턴
TextStyle
: 이 값의 텍스트 스타일입니다.
getTextStyle(startOffset, endOffset)
텍스트의 텍스트 스타일을 startOffset
에서 endOffset
로 반환합니다. 오프셋은 0을 기준으로 하며 셀의 텍스트를 기준으로 합니다. 시작 오프셋은 시작 텍스트를 포함하고 끝 오프셋은 끝 텍스트를 제외합니다.
매개변수
이름 | 유형 | 설명 |
startOffset | Integer | 시작 오프셋입니다. |
endOffset | Integer | 종료 오프셋입니다. |
리턴
TextStyle
: 이 값의 지정된 하위 문자열의 텍스트 스타일입니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 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."]]