要使用Google App脚本更改Google trix中单元格值的字体粗细,我正在使用' setFontWeight'。但是,如果我需要以粗体显示给定的单词,而不是整个单元格值。请在下面的图片中查看预期结果 -
如何使用Google App脚本更改Google Sheet中部分单元格值的字体粗细?
答案 0 :(得分:2)
根据yesterday's release notes(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();
答案 1 :(得分:1)
不幸的是,你无法通过Apps Script以编程方式修改部分单元格。这是一个已经发生的问题。