如何使用 google 应用程序脚本将句子的一部分加粗?

How do you bold only one part of a sentence using google apps scripts?

我正在使用 google 应用程序脚本,我正在尝试使用一个按钮来粘贴“Motion—_____ moved and _____支持 _____。”在 google 文档中。为了仅突出显示前六个字母,我使用了以下代码,但我不断收到此错误消息:

Exception: The parameters (number,number,(class)) don't match the method signature for DocumentApp.Paragraph.setBold.

而不是 (1, 6, true) 我还尝试了 (parseInt('1'),parseInt('6'),true)(one, six, true)('one', 'six', true)。它想从我这里得到什么?

function motion() {
  var body = DocumentApp.getActiveDocument().getBody();
  var par1m = body.appendParagraph('Motion—_____ moved and _____ seconded that _____.');
    par1m.setBold(1, 6, true);
    par1m.setItalic(false);
    par1m.setUnderline(false);
    par1m.setStrikethrough(false);
    par1m.setFontFamily("Times New Roman");
    par1m.setFontSize(12);
    par1m.setForegroundColor('#000000');
    par1m.setAlignment(DocumentApp.HorizontalAlignment.LEFT);```

Paragraph 没有 记录的 setBold() 属性。 Text 确实如此。使用 editAsText() 获取 Text 版本:

var par1m = body.appendParagraph('Motion—_____ moved and _____ seconded that _____.').editAsText();