Zengin metin değerleri için bir oluşturucu.
Yöntemler
Yöntem | Dönüş türü | Kısa açıklama |
---|---|---|
build() | Rich | Bu oluşturucudan zengin metin değeri oluşturur. |
set | Rich | Bu değerin belirli alt dizesi için bağlantı URL'sini ayarlar veya link null ise bağlantı URL'sini temizler. |
set | Rich | Değerin tamamı için bağlantı URL'sini ayarlar veya link null ise bağlantı URL'sini temizler. |
set | Rich | Bu değerin metnini ayarlar ve mevcut metin stilini temizler. |
set | Rich | Bu değerin belirli bir alt dizesi için bir metin stili uygular. |
set | Rich | Değerin tamamına bir metin stili uygular. |
Ayrıntılı dokümanlar
build()
Bu oluşturucudan zengin metin değeri oluşturur.
Return
Rich
: Bu oluşturucudan oluşturulan zengin metin değeri.
setLinkUrl(startOffset, endOffset, linkUrl)
Bu değerin belirli alt dizesi için bağlantı URL'sini ayarlar veya link
null
ise bağlantı URL'sini 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 |
---|---|---|
start | Integer | Alt dizenin başlangıç ofseti (dahil). |
end | Integer | Alt dizenin bitiş ofseti (hariç). |
link | String | Ayarlanan bağlantı URL'si. |
Return
Rich
: Zincirleme için bu oluşturucu.
setLinkUrl(linkUrl)
Değerin tamamı için bağlantı URL'sini ayarlar veya link
null
ise bağlantı URL'sini 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 |
---|---|---|
link | String | Ayarlanan bağlantı URL'si. |
Return
Rich
: Zincirleme için bu oluşturucu.
setText(text)
Bu değerin metnini ayarlar ve mevcut metin stilini temizler. Yeni bir zengin metin değeri oluştururken bu yöntem set
'ten önce çağrılmalıdır.
Parametreler
Ad | Tür | Açıklama |
---|---|---|
text | String | Bu değerin metni. |
Return
Rich
: Zincirleme için bu oluşturucu.
setTextStyle(startOffset, endOffset, textStyle)
Bu değerin belirli bir alt dizesi için bir metin stili uygular. Ofsetler 0 tabanlı olup hücrenin metin değerine göredir. text
null
ise hiçbir işlem yapmaz.
// Creates a Rich Text value for the text "HelloWorld", with "Hello" bolded, and // "World" italicized. const bold = SpreadsheetApp.newTextStyle().setBold(true).build(); const italic = SpreadsheetApp.newTextStyle().setItalic(true).build(); const value = SpreadsheetApp.newRichTextValue() .setText('HelloWorld') .setTextStyle(0, 5, bold) .setTextStyle(5, 10, italic) .build();
Parametreler
Ad | Tür | Açıklama |
---|---|---|
start | Integer | Alt dizenin başlangıç ofseti (dahil). |
end | Integer | Alt dizenin bitiş ofseti (hariç). |
text | Text | Ayarlanan metin stili. |
Return
Rich
: Zincirleme için bu oluşturucu.
setTextStyle(textStyle)
Değerin tamamına bir metin stili uygular. Daha önce ayarlanmış metin stilleri yalnızca text
içindeki değerlerle doğrudan üzerine yazılmışsa etkilenir. text
null
ise hiçbir işlem yapmaz.
// Creates a Rich Text value for the text "HelloWorld" with "Hello" bolded and // italicized, and "World" only italicized. const bold = SpreadsheetApp.newTextStyle().setBold(true).build(); const italic = SpreadsheetApp.newTextStyle().setItalic(true).build(); const value = SpreadsheetApp.newRichTextValue() .setText('HelloWorld') .setTextStyle(0, 5, bold) .setTextStyle(italic) .build();
Parametreler
Ad | Tür | Açıklama |
---|---|---|
text | Text | Ayarlanan metin stili. |
Return
Rich
: Zincirleme için bu oluşturucu.