أداة إنشاء لقيم النصوص المنسّقة
الطُرق
| الطريقة | نوع القيمة التي يتم عرضها | وصف قصير |
|---|---|---|
build() | Rich | تُنشئ قيمة نص منسق من هذا المُنشئ. |
set | Rich | لضبط عنوان URL للرابط الخاص بالسلسلة الفرعية المحدّدة من هذه القيمة، أو لحذفه إذا كان link هو
null. |
set | Rich | لضبط عنوان URL للرابط للقيمة بأكملها أو محوه إذا كان link يساوي null |
set | Rich | تُستخدَم لضبط النص لهذه القيمة ومحو أي أسلوب نص حالي. |
set | Rich | تُطبِّق هذه الدالة نمط نص على السلسلة الفرعية المحدّدة من هذه القيمة. |
set | Rich | تُطبِّق نمط نص على القيمة بأكملها. |
مستندات تفصيلية
build()
set Link Url(startOffset, endOffset, linkUrl)
لضبط عنوان URL للرابط الخاص بالسلسلة الفرعية المحدّدة من هذه القيمة، أو لحذفه إذا كان link هو
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 للرابط الذي يتم ضبطه |
الإرجاع
Rich: هذا المُنشئ، لتسلسل العناصر.
set Link Url(linkUrl)
لضبط عنوان URL للرابط للقيمة بأكملها أو محوه إذا كان link يساوي 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 للرابط الذي يتم ضبطه |
الإرجاع
Rich: هذا المُنشئ، لتسلسل العناصر.
set Text(text)
تُستخدَم لضبط النص لهذه القيمة ومحو أي أسلوب نص حالي. عند إنشاء قيمة جديدة لنص غني، يجب استدعاء هذا الإجراء قبل set.
المعلمات
| الاسم | النوع | الوصف |
|---|---|---|
text | String | نص هذه القيمة. |
الإرجاع
Rich: هذا المُنشئ، لتسلسل العناصر.
set Text Style(startOffset, endOffset, textStyle)
تُطبِّق هذه الدالة نمط نص على السلسلة الفرعية المحدّدة من هذه القيمة. تستند العناصر المرجعية إلى القيمة 0 وهي نسبية
لقيمة النص في الخلية. لا يتم تنفيذ أي إجراء إذا كان text يساوي 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 | نمط النص الذي يتم ضبطه |
الإرجاع
Rich: هذا المُنشئ، لتسلسل العناصر.
set Text Style(textStyle)
تُطبِّق نمط نص على القيمة بأكملها. لا تتأثّر أنماط النصوص التي تم ضبطها سابقًا إلا إذا
تم استبدالها مباشرةً بقيم ضمن text. لا يتم تنفيذ أي إجراء إذا كان text
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 | نمط النص الذي يتم ضبطه |
الإرجاع
Rich: هذا المُنشئ، لتسلسل العناصر.