1
如何通過Google Apps腳本一次更改多行的高度?如何一次更改多行的高度?
嘗試:
function resizeHeight() {
var s = SpreadsheetApp,
ui = s.getUi(),
sh = s.getActiveSheet(),
curntRow = s.getActiveRange().getRow(),
rowsMany = s.getActiveRange().getNumRows(),
autoRangeRows = s.getActiveRange().getA1Notation().replace(/[a-z]/gi,""),
getVal = ui.prompt('⿱⇕', 'Change the height of row❓ Cancel. Back to default❗ (21)', ui.ButtonSet.OK_CANCEL),
Btn = getVal.getSelectedButton(), Txt = getVal.getResponseText();
for (var i=curntRow; i<=rowsMany+1; i++) {
if (Btn == 'OK') {
if (autoRangeRows.search(":") == -1) {sh.setRowHeight(curntRow, Txt);}
else {sh.setRowHeight(i, Txt);}
}
if (Btn == 'CANCEL') {
if (autoRangeRows.search(":") == -1) {sh.setRowHeight(curntRow, 21);}
else {sh.setRowHeight(i, 21);}
}
}
}
問題:
劇本不是很有效,他們只是對所有行可以實現部分或幾行,但不起作用。
似乎對我來說過於複雜。 – Cooper