Google UI App Scripts: Create a Google Doc with a legal paper size and landscape layout

佐手、 提交于 2020-06-11 05:48:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!