How to Change Bullet Point Font Size and Style in Google Docs using Google Apps Script?

32 views Asked by At

I'm working on a Google Apps Script to generate a Google Docs document from data stored in Google Sheets. My script creates sections in the document with lists, and I need these lists to have bullet points that match the text font (Lora, size 10). However, despite setting the text font and size using Apps Script, the bullet points themselves appear to default to Arial size 11, which does not match the rest of my document's formatting.

function appendDetailsWithNewLine(docBody, title, content) {
  if (content) {
    var tasksOrResults = content.split("\n"); // Each task/result is a new line in Sheets
    for (var i = 0; i < tasksOrResults.length; i++) {
      if (tasksOrResults[i].trim() !== "") {
        var listItem = docBody.appendListItem(tasksOrResults[i].trim());
        listItem.setGlyphType(DocumentApp.GlyphType.BULLET);
        listItem.editAsText().setFontFamily('Lora').setFontSize(10).setBold(false);
      }
    }
  }
}

The text of the list items is correctly formatted as Lora, size 10, but the bullet points remain in Arial, size 11. I've searched through the Google Apps Script documentation but haven't found a way to directly modify the bullet point style to match the text.

Is there a way to programmatically change the font size of bullet points in Google Docs using Google Apps Script?2

0

There are 0 answers