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 değeri null ise bağlantı URL'sini temizler.
setLinkUrl(linkUrl)RichTextValueBuilderDeğerin tamamı için bağlantı URL'sini ayarlar veya linkUrl null ise bağlantı URL'sini temizler.
setText(text)RichTextValueBuilderBu değer için metni ayarlar ve mevcut metin stilini temizler.
setTextStyle(startOffset, endOffset, textStyle)RichTextValueBuilderBu değerin belirtilen alt dizesine bir metin stili uygular.
setTextStyle(textStyle)RichTextValueBuilderDeğerin tamamına 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 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

AdTürAçıklama
startOffsetIntegerAlt dizenin başlangıç ofseti (dahil).
endOffsetIntegerAlt dizenin bitiş kayması (hariç).
linkUrlStringAyarlanacak bağlantı URL'si.

Return

RichTextValueBuilder: Zincirleme için kullanılan bu oluşturucu.


setLinkUrl(linkUrl)

Değerin tamamı için bağlantı URL'sini ayarlar veya linkUrl 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

AdTürAçıklama
linkUrlStringAyarlanacak bağlantı URL'si.

Return

RichTextValueBuilder: Zincirleme için kullanılan bu oluşturucu.


setText(text)

Bu değer için metni ayarlar ve mevcut metin stilini temizler. Yeni bir zengin metin değeri oluştururken bu yöntem, setTextStyle(startOffset, endOffset, textStyle) yönteminden önce çağrılmalıdır.

Parametreler

AdTürAçıklama
textStringBu değerin metni.

Return

RichTextValueBuilder: Zincirleme için kullanılan bu oluşturucu.


setTextStyle(startOffset, endOffset, textStyle)

Bu değerin belirtilen alt dizesine bir metin stili uygular. Ofsetler 0 tabanlıdır ve hücrenin metin değerine göre belirlenir. textStyle null ise hiçbir işlem yapılmaz.

// 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

AdTürAçıklama
startOffsetIntegerAlt dizenin başlangıç ofseti (dahil).
endOffsetIntegerAlt dizenin bitiş kayması (hariç).
textStyleTextStyleAyarlanan metin stili.

Return

RichTextValueBuilder: Zincirleme için kullanılan bu oluşturucu.


setTextStyle(textStyle)

Değerin tamamına metin stili uygular. Daha önce ayarlanan metin stilleri yalnızca textStyle içindeki değerlerle doğrudan üzerine yazılırsa etkilenir. textStyle ise hiçbir şey yapmaz.null

// 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

AdTürAçıklama
textStyleTextStyleAyarlanan metin stili.

Return

RichTextValueBuilder: Zincirleme için kullanılan bu oluşturucu.