Class RichTextValueBuilder

RichTextValueBuilder

Zengin Metin değerleri için bir oluşturucu.

Yöntemler

YöntemDönüş türüKısa açıklama
build()RichTextValueBu oluşturucudan bir Zengin Metin değeri oluşturur.
setLinkUrl(startOffset, endOffset, linkUrl)RichTextValueBuilderBu değerin belirtilen alt dizesi için bağlantı URL'sini ayarlar veya linkUrl, null ise bunu temizler.
setLinkUrl(linkUrl)RichTextValueBuilderDeğerin tamamı için bağlantı URL'sini ayarlar veya linkUrl null ise bunu temizler.
setText(text)RichTextValueBuilderBu değer için metni ayarlar ve mevcut metin stillerini temizler.
setTextStyle(startOffset, endOffset, textStyle)RichTextValueBuilderBu değerin belirtilen alt dizesine bir metin stili uygular.
setTextStyle(textStyle)RichTextValueBuilderDeğ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

AdTürAçıklama
startOffsetIntegerAlt dize için başlangıç ofseti (bu değerler dahil).
endOffsetIntegerAlt dize için bitiş ofseti (hariç).
linkUrlStringAyarlanan 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

AdTürAçıklama
linkUrlStringAyarlanan 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

AdTürAçıklama
textStringBu 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

AdTürAçıklama
startOffsetIntegerAlt dize için başlangıç ofseti (bu değerler dahil).
endOffsetIntegerAlt dize için bitiş ofseti (hariç).
textStyleTextStyleAyarlanan 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

AdTürAçıklama
textStyleTextStyleAyarlanan metin stili.

Return

RichTextValueBuilder — Zincirleme için bu oluşturucu.