参考下面的宏代码看看:
function main(spreadsheetReport) {
var lastCell = spreadsheetReport.paramPanelObj;
var paramTable = spreadsheetReport.paramPanelObj.layoutTable;
if (paramTable.rows.length === 0) {
return;
}
var i, cell;
// 在参数同一行添加按钮
for (i = 0; i < paramTable.rows.length; i++) {
cell = paramTable.rows.insertCell(-1);
if (i == paramTable.rows.length - 1)
lastCell = cell;
}
if (!spreadsheetReport._newBtn) { // 不重复添加按钮
var input = document.createElement("INPUT");
input.type = "button";
input.value = "重置参数";
input.title = "重置参数";
input.style.width = "70px";
input.style.height = "20px";
var newBtn = lastCell.appendChild(input);