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
}