I'm trying to append a text in a doc via apps script, but I want the text to start from a specified left indent, and also have subsequent lines aligned with the indent. Currently, I'm using \\t to tab the first line, but subsequent lines start on indent 0. I would appreciate if anyone could help figure it out.
Example:
body.appendParagraph('').setLineSpacing(1.5).appendText('\t\t' + 'mylongtext').setItalic(true);
Looking at the available paragraph classes here https://developers.google.com/apps-script/reference/document/paragraph you will need to edit your code as follows:
body.appendParagraph('').setLineSpacing(1.5).setIndentFirstLine(50).setIndentStart(50).appendText('mylongtext').setItalic(true);
Adjust the number in the () as needed for setIndentFirstLine and setIndentStart, which is in pixels.
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.