DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Bruce Axtens
Bruce Axtens

Posted on

How to get Google Apps Script to tell Google Docs to bold, italic, strikethrough and underline from a JSON representation?

0

I have written a function, setParagraphToRichText which accepts a GoogleAppsScript.Document.Paragraph and a string. The string is a stringified JSON blob that defines the text and attributes of a given paragraph.

/**
 *
 *
 * @param {GoogleAppsScript.Document.Paragraph} paragraph
 * @param {string} jsonString
 */
function setParagraphToRichText(paragraph, jsonString) {
  const text = paragraph.editAsText();
…

Top comments (1)

Collapse
 
bugmagnet profile image
Bruce Axtens Author • Edited on

Turns out it was a typo. So not Google's fault but mine. Sigh. Old and decrepit much.

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.