以下脚本用于在“待办事项”第9列中将“否”更改为“是”时,从ToDo
工作表移动到另一个工作表Completed
。然后在ToDo
中删除该行。执行记录显示脚本正常运行但结果未显示在Completed
中。也没有在ToDo
中删除该行。我在第9列进行编辑时设置了触发器来运行脚本。此时,我不知道为什么它不起作用。
function onEdit(event) {
// source data in sheet named ToDo
// target sheet named Comleted
// test column with yes/no is col 9 or I
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();
if(s.getName() == "ToDo" && r.getColumn() == 9 && r.getValue() == "yes") {
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Comleted");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, numColumns);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);
}
}
答案 0 :(得分:0)
变化:
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1,1,numColumns);
到
public static void setTabStop(XWPFParagraph oParagraph, STTabJc.Enum oSTTabJc, BigInteger oPos)
{
CTP oCTP = oParagraph.getCTP();
CTPPr oPPr = oCTP.getPPr();
if(oPPr == null)
{
oPPr = oCTP.addNewPPr();
}
CTTabs oTabs = oPPr.getTabs();
if(oTabs == null)
{
oTabs = oPPr.addNewTabs();
}
CTTabStop oTabStop = oTabs.addNewTab();
oTabStop.setVal(oSTTabJc);
oTabStop.setPos(oPos);
}
以及@pnuts建议“已完成”到“已完成”的拼写错误