Set Line Space of Paragraph on Google Document using Google Apps Script
This is a sample script for setting the line space of paragraphs on Google Documents using Google Apps Script.
When the line space of a paragraph on Google Documents is manually set, you can do it as follows.
When it is set with Google Apps Script, the following script can be used.
function sample1() {
const doc = DocumentApp.getActiveDocument();
const body = doc.getBody();
const paragraph = body.appendParagraph(
"sample paragraph 1\nsample paragraph 2\nsample paragraph 3"
);
paragraph.setLineSpacing(2); // Double
}
When this script is run, the appended paragraphs have a line space of 2 (Double).