DEV Community

Bruce Axtens
Bruce Axtens

Posted on

1

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 • Edited

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

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more