Zengin Metin değerleri için bir oluşturucu.
Yöntemler
Yöntem | Dönüş türü | Kısa açıklama |
---|---|---|
build() | RichTextValue | Bu oluşturucudan bir Zengin Metin değeri oluşturur. |
setLinkUrl(startOffset, endOffset, linkUrl) | RichTextValueBuilder | Bu değerin belirtilen alt dizesi için bağlantı URL'sini ayarlar veya linkUrl , null ise bunu temizler. |
setLinkUrl(linkUrl) | RichTextValueBuilder | Değerin tamamı için bağlantı URL'sini ayarlar veya linkUrl null ise bunu temizler. |
setText(text) | RichTextValueBuilder | Bu değer için metni ayarlar ve mevcut metin stillerini temizler. |
setTextStyle(startOffset, endOffset, textStyle) | RichTextValueBuilder | Bu değerin belirtilen alt dizesine bir metin stili uygular. |
setTextStyle(textStyle) | RichTextValueBuilder | Değerin tamamına bir metin stili uygular. |
Ayrıntılı belgeler
build()
Bu oluşturucudan bir Zengin Metin değeri oluşturur.
Return
RichTextValue
: Bu oluşturucudan oluşturulan bir Zengin Metin değeri.
setLinkUrl(startOffset, endOffset, linkUrl)
Bu değerin belirtilen alt dizesi için bağlantı URL'sini ayarlar veya linkUrl
, null
ise bunu temizler.
// Creates a Rich Text value for the text "foo no baz" with "foo" pointing to // "https://bar.foo" and "baz" to "https://abc.xyz". // "foo" is underlined with the default link color, whereas "baz" has its text style // overridden by a call to `setTextStyle`, and is therefore black and bold with no underlining. const boldStyle = SpreadsheetApp.newTextStyle() .setUnderline(false) .setBold(true) .setForegroundColor("#000000") .build(); const value = SpreadsheetApp.newRichTextValue() .setText("foo no baz") .setLinkUrl(0, 3, "https://bar.foo") .setLinkUrl(7, 10, "https://abc.xyz") .setTextStyle(7, 10, boldStyle) .build();
Parametreler
Ad | Tür | Açıklama |
---|---|---|
startOffset | Integer | Alt dize için başlangıç ofseti (bu değerler dahil). |
endOffset | Integer | Alt dize için bitiş ofseti (hariç). |
linkUrl | String | Ayarlanan bağlantı URL'si. |
Return
RichTextValueBuilder
— Zincirleme için bu oluşturucu.
setLinkUrl(linkUrl)
Değerin tamamı için bağlantı URL'sini ayarlar veya linkUrl
null
ise bunu temizler.
// Creates a Rich Text value for the text "Foo" which points to "https://bar.foo". const value = SpreadsheetApp.newRichTextValue() .setText("Foo") .setLinkUrl("https://bar.foo") .build();
Parametreler
Ad | Tür | Açıklama |
---|---|---|
linkUrl | String | Ayarlanan bağlantı URL'si. |
Return
RichTextValueBuilder
— Zincirleme için bu oluşturucu.
setText(text)
Bu değer için metni ayarlar ve mevcut metin stillerini temizler. Yeni bir Zengin Metin değeri oluştururken, bu değer setTextStyle(startOffset, endOffset, textStyle)
öncesinde çağrılmalıdır.
Parametreler
Ad | Tür | Açıklama |
---|---|---|
text | String | Bu değere ait metin. |
Return
RichTextValueBuilder
— Zincirleme için bu oluşturucu.
setTextStyle(startOffset, endOffset, textStyle)
Bu değerin belirtilen alt dizesine bir metin stili uygular. Kaydırmalar 0 tabanlıdır ve hücrenin metin değerine göre belirlenir. textStyle
, null
ise hiçbir şey yapmaz.
// Creates a Rich Text value for the text "HelloWorld", with "Hello" bolded, and "World" // italicized. var bold = SpreadsheetApp.newTextStyle().setBold(true).build(); var italic = SpreadsheetApp.newTextStyle().setItalic(true).build(); var value = SpreadsheetApp.newRichTextValue() .setText("HelloWorld") .setTextStyle(0, 5, bold) .setTextStyle(5, 10, italic) .build();
Parametreler
Ad | Tür | Açıklama |
---|---|---|
startOffset | Integer | Alt dize için başlangıç ofseti (bu değerler dahil). |
endOffset | Integer | Alt dize için bitiş ofseti (hariç). |
textStyle | TextStyle | Ayarlanan metin stili. |
Return
RichTextValueBuilder
— Zincirleme için bu oluşturucu.
setTextStyle(textStyle)
Değerin tamamına bir metin stili uygular. Önceden ayarlanan metin stilleri yalnızca textStyle
içindeki değerler tarafından doğrudan üzerine yazılırsa etkilenir. textStyle
, null
ise hiçbir şey yapmaz.
// Creates a Rich Text value for the text "HelloWorld" with "Hello" bolded and italicized, // and "World" only italicized. var bold = SpreadsheetApp.newTextStyle().setBold(true).build(); var italic = SpreadsheetApp.newTextStyle().setItalic(true).build(); var value = SpreadsheetApp.newRichTextValue() .setText("HelloWorld") .setTextStyle(0, 5, bold) .setTextStyle(italic) .build();
Parametreler
Ad | Tür | Açıklama |
---|---|---|
textStyle | TextStyle | Ayarlanan metin stili. |
Return
RichTextValueBuilder
— Zincirleme için bu oluşturucu.