Posted 10 September 2019, 9:04 pm EST
Hi there,
We use the spread version @grapecity/spread-sheets: “^12.2.4” to build up our financial statements. This is built as a canvas image on our website
Steps followed:
- Login to Site
- Go to the page that brings up the financial statement on a spreadsheet
- Initialize the spread instance as illustrated on the code snippet below
- Evaluate for any errors where it returns an error despite of any formula error on the spreadsheet
Tried clearing the cache of the browser/npm as well. Cypress already clears the browsers before it starts the tests. So, we cannot get our head around as to why it’s not able to use the evaluateFormula() function as we wanted it to.
Please find the code snippet used to validate for your perusal
cy.window().then((appWindow) => {
let spreadHostElement = appWindow.document.querySelector(‘[gcuielement=“gcSpread”]’);
spread = appWindow.GC.Spread.Sheets.findControl(spreadHostElement);
let value = spread.getActiveSheet().getValue(116, 5);
let activeSheet = spread.getActiveSheet(),
rCount = activeSheet.getRowCount(),
cCount = activeSheet.getColumnCount();
let formula = "=SUMPRODUCT(--ISERROR(R1C1:R" + rCount + "C" + cCount + "))";
let errCount = appWindow.GC.Spread.Sheets.CalcEngine.evaluateFormula(
activeSheet,
formula,
0,
0,
true
);
cy.log(value); //Returns the actual value of the cell
cy.log(errCount); //Always returns the error {_error: #NAME?, _code: 29} despite a cell has a formula issue or not
expect(errCount).to.eq(0); //Returns an error despite of the issue with the cell that contains the formula
});