使用Google UI应用脚本,如何创建一个具有合法纸张尺寸和横向布局的新Google Doc?在文档服务页面中,我看到了如何创建新文档并编辑许多元素,但看不到页面大小或布局方向。我错过了吗?还是这是不可能的?
可以使用 body 类的 setPageHeight 和 setPageWidth 方法来设置文档的纸张大小
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
}