I've been trying to write a script that will output two lines to a google doc. The lines need to spaced closer together than the default. In the editor I can click the line spacing icon and select "Custom Spacing" then set it to a value like 0.5 to make the lines closer together. I've been trying to achieve the same thing in app scripts, but every time the line spacing value will default to 1. It's almost like my value is being rounded up at some point.
This code reproduces my issue:
let docBody = DocumentApp.openByUrl("URL OF BLANK GOOGLE DOC").getBody()
let p1 = docBody.appendParagraph("")
p1.setAlignment(DocumentApp.HorizontalAlignment.CENTER)
p1.setLineSpacing(0.5)
let line1 = p1.appendText(`Line 1\r`)
line1.setFontSize(30)
let line2 = p1.appendText("line 2")
line2.setFontFamily("Roboto Mono")
line2.setFontSize(10)
console.log(p1.getLineSpacing())
p1.getLineSpacing returns 0.5 and there are no errors, but in the document the line spacing is always set to 1. If I change 0.5 to something above 1 (like 1.43), it will set the property like it's supposed to. I can also go into the document and change the line spacing normally, but I can't seem to set it from the script.
Is there a reason it can't be set this way?