繁体   English   中英

如何在 Apps 脚本中设置字体粗细 - Google Docs

[英]How to Set the Font Weight in Apps Script - Google Docs

查看文档参考(在此处找到),我找不到任何方法来设置段落元素的字体粗细。

甚至有可能这样做吗?

任何帮助表示赞赏。 提前致谢。

在正常和粗体粗细之间进行调整:

  1. 使用setAttributes并将DocumentApp.Attribute.BOLD设置为truefalse (如上面提到的@Tanaike)。
  2. 使用setBold(bold)setBold(startOffset, endOffsetInclusive, bold)

To set weights other than normal and bold for fonts that include additional weights (eg the medium weight of Alegreya Sans) there's an apparently undocumented method: use the setFontFamily(fontFamilyName) or setFontFamily(startOffset, endOffsetInclusive, fontFamilyName) method and append a semicolon and字体系列字符串的数字CSS 字体重量,如下所示:

someElement.setFontFamily('Alegreya Sans;500')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM