Google UI应用程序脚本:使用合法的纸张尺寸和横向布局创建Google文档 [英] Google UI App Scripts: Create a Google Doc with a legal paper size and landscape layout

查看:80
本文介绍了Google UI应用程序脚本:使用合法的纸张尺寸和横向布局创建Google文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Google UI App脚本,如何创建具有合法纸张尺寸和横向布局的新Google文档?在文档服务页上,我了解了如何创建新文档并进行编辑很多元素,但不是页面大小或布局方向.我想念它吗?还是这不可能?

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?

推荐答案

可以使用setPageWidth 方法 /p>

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
  }

这篇关于Google UI应用程序脚本:使用合法的纸张尺寸和横向布局创建Google文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆