[]
Each time a user invokes the API to change the formula, SpreadJS will auto calculate in order to respond to the modifications. If a user wants to integrate a lot of changes in the formulas at once but doesn't wish to see the intermediate calculation result, it is recommended to use the suspendCalcService method and the resumeCalcService method.
The suspendCalcService method will stop the calculation process until the formula settings are complete. Later, the resumeCalcService method can be called to restore the calculation system. Both of these methods enhance performance to a great extent especially when users have massive worksheets with a lot of formulas.
Refer to the following code sample to set large amounts of formulas in the worksheets using the suspendCalcService method and the resumeCalcService method.
var spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), { sheetCount: 1 });
var sheet = spread.getSheet(0);
spread.suspendPaint();
sheet.suspendCalcService(true);
sheet.setRowCount(10000);
sheet.setColumnCount(100);
for (var i = 0; i < 10000; i++)
{
for (var j = 0; j < 100; j++)
{
sheet.setFormula(i, j, "DATE(2019,3,11)", GC.Spread.Sheets.SheetArea.viewport);
sheet.getCell(i, j).formatter("yyyy/mm/dd");
sheet.setColumnWidth(j, 80.0, GC.Spread.Sheets.SheetArea.viewport);
}
}
sheet.resumeCalcService(false);
spread.resumePaint();