我需要设置 dialog in a Google Spreadsheet 的宽度.
到目前为止我的代码是:
// Use this code for Google Docs, Forms, or new Sheets.
function onOpen() {
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.createMenu('Cadastro')
.addItem('Open', 'openDialog')
.addToUi();
}
function openDialog() {
var html = HtmlService.createHtmlOutputFromFile('index');
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.showModalDialog(html, 'Dialog title');
}`enter code here`
最佳答案
这将设置您的高度和宽度。
function openDialog() {
var html = HtmlService.createHtmlOutputFromFile('index')
.setHeight(100)
.setWidth(100);
SpreadsheetApp.getUi() // Or DocumentApp or FormApp
.showModalDialog(html, 'Dialog title')
}//`enter code here`
当然,您还需要将index.html文件添加到脚本编辑器,例如:
Hello, world! <input type="button" value="Close" onclick="google.script.host.close()" />
关于javascript - 函数 openDialog() 设置宽度和设置高度 Google 电子表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39638525/