-
Type:
New Feature
-
Resolution: Done
-
Priority:
Normal
-
Affects Version/s: 3.6.0
-
Component/s: None
-
Security Level: Jimmy
-
None
Problem Description
Currently, ZSS importer doesn't import Excel formula cache and formula evaluation might take long time when loading an Excel file with massive formulas.
Workaround
Use Case:
Users want to find all cells with error value, this procedure takes long time because it causes formula evalution to get error result.
To set formula cache result for those cells with a formula error during importing.
Because in org.zkoss.zss.model.impl.CellImpl.evalFormula(), if _formulaResultValue!=null, it won't continue to evaluate a formula.
public class FormulaErrorCacheImporter extends ExcelXlsxImporter { @Override protected SCell importCell(Cell poiCell, int row, SSheet sheet) { SCell cell = super.importCell(poiCell, row, sheet); if (poiCell.getCellType() == Cell.CELL_TYPE_FORMULA && poiCell.getCachedFormulaResultType() == Cell.CELL_TYPE_ERROR) { ((AbstractCellAdv)cell).setFormulaResultValue(ErrorEval.valueOf(poiCell.getErrorCellValue())); } return cell; } }