כלי ליצירת ערכים של טקסט עשיר.
Methods
| שיטה | סוג הערך שמוחזר | תיאור קצר |
|---|---|---|
build() | Rich | יוצרת ערך של טקסט עשיר מה-builder הזה. |
set | Rich | מגדיר את כתובת הקישור עבור מחרוזת המשנה הנתונה של הערך הזה, או מוחק אותה אם link הוא
null. |
set | Rich | מגדיר את כתובת ה-URL של הקישור לכל הערך, או מוחק אותה אם link הוא null. |
set | Rich | מגדירה את הטקסט של הערך הזה ומנקה את סגנון הטקסט הקיים. |
set | Rich | מחילה סגנון טקסט על מחרוזת המשנה הנתונה של הערך הזה. |
set | Rich | החלת סגנון טקסט על כל הערך. |
תיעוד מפורט
build()
setLinkUrl(startOffset, endOffset, linkUrl)
מגדיר את כתובת הקישור עבור מחרוזת המשנה הנתונה של הערך הזה, או מוחק אותה אם linkUrl הוא
null.
// 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();
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
start | Integer | ההיסט של תחילת המחרוזת המשנית, כולל. |
end | Integer | ההיסט של סוף מחרוזת המשנה, לא כולל. |
link | String | כתובת ה-URL של הקישור שמוגדר. |
חזרה
RichTextValueBuilder – ה-builder הזה, לשרשור.
setLinkUrl(linkUrl)
מגדיר את כתובת ה-URL של הקישור לכל הערך, או מוחק אותה אם linkUrl הוא null.
// 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();
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
link | String | כתובת ה-URL של הקישור שמוגדר. |
חזרה
RichTextValueBuilder – ה-builder הזה, לשרשור.
setText(text)
מגדירה את הטקסט של הערך הזה ומנקה את סגנון הטקסט הקיים. כשיוצרים ערך חדש של טקסט עשיר, צריך לקרוא לשיטה הזו לפני setTextStyle(startOffset, endOffset, textStyle).
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
text | String | הטקסט של הערך הזה. |
חזרה
RichTextValueBuilder – ה-builder הזה, לשרשור.
setTextStyle(startOffset, endOffset, textStyle)
מחילה סגנון טקסט על מחרוזת המשנה הנתונה של הערך הזה. ההיסטים מבוססים על 0 והם יחסיים לערך הטקסט של התא. לא עושה כלום אם textStyle הוא null.
// 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();
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
start | Integer | ההיסט של תחילת המחרוזת המשנית, כולל. |
end | Integer | ההיסט של סוף מחרוזת המשנה, לא כולל. |
text | Text | סגנון הטקסט שמוגדר. |
חזרה
RichTextValueBuilder – ה-builder הזה, לשרשור.
setTextStyle(textStyle)
החלת סגנון טקסט על כל הערך. סגנונות טקסט שהוגדרו בעבר מושפעים רק אם הם נמחקים ישירות על ידי ערכים בתוך textStyle. לא עושה כלום אם textStyle
הוא 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();
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
text | Text | סגנון הטקסט שמוגדר. |
חזרה
RichTextValueBuilder – ה-builder הזה, לשרשור.