简体   繁体   中英

Set line spacing between lines of a list using Google Apps Script

all,

Here's the documentation I'm looking at: https://developers.google.com/apps-script/reference/slides/paragraph-style#setspacebelowspace

I'm trying to edit a Google Slides presentation with a script, and specifically, I'm trying to create a numbered list in a text box, with 1.15 spaced lines, and 10 pixels between each list item. The code is below - recapBox is the text box in question.

var lines = recapBox.getText().getListParagraphs();
lines.forEach(function(line) {
  line.getRange().getParagraphStyle().setLineSpacing(115).setSpaceBelow(10);
});

It turns out, setLineSpacing(115) appears to work. However, doing setSpaceBelow only sets a 10-pixel space below the entire list, not below each individual list item. Can anyone help me figure out how to do it for each item?

Thanks in advance!

I figured it out.

https://developers.google.com/apps-script/reference/slides/spacing-mode

var lines = recapBox.getText().getListParagraphs();
lines.forEach(function(line) {
   line.getRange().getParagraphStyle().setSpacingMode(SlidesApp.SpacingMode.NEVER_COLLAPSE).setLineSpacing(115).setSpaceBelow(10);
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM