Skip to content

Commit f567dae

Browse files
Fix for #84. Also supports copy/paste. (#147)
1 parent c0875ac commit f567dae

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

zssmodel/src/org/zkoss/zss/model/impl/sys/formula/FormulaEngineImpl.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,21 @@ && isValidColumnIndex(book, c0) && isValidColumnIndex(book, c1)) {
817817
} else {
818818
tokens[i] = PtgShifter.createDeletedRef(aptg);
819819
}
820+
} else if (ptg instanceof FuncVarPtg) {
821+
FuncVarPtg funcVarPtg = (FuncVarPtg) ptg;
822+
/* Special Handing for index function */
823+
if (funcVarPtg.getName().equals("INDEX"))
824+
{
825+
if (i>2 &&
826+
tokens[i-1] instanceof IntPtg &&
827+
tokens[i-2] instanceof IntPtg)
828+
{
829+
IntPtg row = (IntPtg) tokens[i-2];
830+
IntPtg col = (IntPtg) tokens[i-1];
831+
tokens[i-2] = new IntPtg(row.getValue() + rowOffset);
832+
tokens[i-1] = new IntPtg(col.getValue() + columnOffset);
833+
}
834+
}
820835
}
821836
}
822837
return true;

0 commit comments

Comments
 (0)