我需要设置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`
答案 0 :(得分:0)
这将设置您的身高和宽度。
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()" />