aks*_*aks 3 text-formatting google-sheets google-apps-script
要使用 Google App 脚本更改 Google trix 中单元格值的字体粗细,我使用了“setFontWeight”。但是,如果我需要以粗体显示给定的单词,而不是整个单元格值。请在下图中查看预期结果 -
如何使用 Google App 脚本更改 Google Sheet 中部分单元格值的字体粗细?
根据昨天的发行说明(2019 年 1 月 22 日),电子表格服务已扩展为包括RichTextValue等新类,现在可以设置部分文本的格式。
// 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();
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1325 次 |
最近记录: |