Posted 26 June 2018, 7:41 am EST
Hi,
When dealing with formulas, we found that APIs in V9 and V11 are behaving differently, especially when we suspend CalcService, and enter a invalid formula.
in V9: sheet.hasFormula(row, col) returns false and sheet.getCell(row,col).formula() returns null
in V11: sheet.hasFormula(row, col) returns trueand sheet.getCell(row,col).formula() returns formula entered by user
Note: Invalid formula can we incomplete formula like =max() or a syntactically wrong formula like entering English formula in some other culture.
Please find the attached V9 and V11 html files, to reproduce.
Steps:
-
go to any cell (for example 0,0 cell) and enter =IF(true,1,2)
note: this is a wrong formula, as we are setting a different culture to the spread. -
go to console and execute sheet.hasFormula(0,0) → we will see false in V9 and true in V11
-
go to console and execute sheet.getCell(0,0).formula() → we will see nullin V9 and If(true,1,2) in V11
(or)
- go to any cell (for example 0,0 cell) and enter =max()
- go to console and execute sheet.hasFormula(0,0) → we will see false in V9 and true in V11
- go to console and execute sheet.getCell(0,0).formula() → we will see null in V9 and max() in V11
Can you please tell us how to handle these differences? Is there a way to identify invalid formula?
Thanks,
Viswanath
