调整附件侧边栏的大小,以便于使用

时间:2018-06-27 07:58:22

标签: google-apps-script google-sheets google-docs google-apps-script-addon

我正在尝试使用Google Apps脚本实现交互式页面。我已经在UI边栏中成功打开了一个文档,但是边栏的尺寸使其难以使用:

如何使嵌入式侧边栏页面更具吸引力/更易于使用?

我的Google文档在这里:https://docs.google.com/document/d/17AtHwUSQdci-lh7BDvXeELcpZdXr27AryHlfagRR4Hg/edit

enter image description here Gode.gs

      var TITLE = 'Sidebar Title';


      //Here is the code.gs code:
      function onOpen() {
        var ui = DocumentApp.getUi();
        ui.createMenu('==Sidebar==')
        .addItem('Show Document','SideBar3')
        .addToUi();
      };

      function SideBar3()
      {
        var ui = HtmlService.createHtmlOutputFromFile('ModeLessDialog').setTitle('Handler Communications');
         ui.setWidth(800)

        DocumentApp.getUi().showSidebar(ui);
      }

 //Here is the HTML file.  I called it ModeLessDialog.html
    <!DOCTYPE html>
    <html>
      <head>
        <base target="_top">
      </head>
      <body>
      <iframe  src="https://docs.google.com/document/d/1yb7knN941rdS-6okHQu_ZkvkgIaqXUIMioSAru9fzK4/" height="1000" width="90%"></iframe>

      </body>
    </html>

1 个答案:

答案 0 :(得分:1)

您不能再更改Google插件中的边栏宽度。 UI之前有setWidth()方法,但现在已弃用。

In Google Docs and Forms, sidebars now ignore the setWidth() method; they cannot be changed from the default width of 300px. 

请参阅release notes提及此更改。