问题
Using Google UI App Scripts how can you create a new Google Doc with a legal paper size and landscape layout? From the Document Service page I see how you can create a new document and edit a lot of the elements but not the page size or layout orientation. Am I missing it? Or is this something that is not possible?
回答1:
Paper size of the document can be set using setPageHeight and setPageWidth methods of the class Body
function setPageSize(){
var doc = DocumentApp.create("file name");
var body = doc.getBody();
var pointsInInch = 72;
body.setPageHeight(6.5 * pointsInInch); //6.5 - inches
body.setPageWidth(4 * pointsInInch); // 4 - inches
}
来源:https://stackoverflow.com/questions/21943661/google-ui-app-scripts-create-a-google-doc-with-a-legal-paper-size-and-landscape