单元格通过绑定tag属性对象,调用前台字段的公式进行计算,如果公式单元鼠标获取焦点,计算时报错;如果公式单元鼠标没获取焦点,计算时不报错
关键代码如下
var curTag = curSheet.getTag(curCell.row, curCell.col);
var curCellformula = curCell.formula;
var curCell00Value = curSheet.getCell(0,0).value();
curSheet.setFormula(0, 0, curCellformula);
var curSumValue = curSheet.getCell(0, 0).value();
curValue = curSumValue*1;
curSheet.setFormatter(curCell.row, curCell.col, '0#.00##');
curSheet.setValue(curCell.row, curCell.col, curValue);
curSheet.setTag(curCell.row, curCell.col, curTag);
curSheet.setFormula(0, 0, "");
curSheet.setValue(0, 0, curCell00Value);
|