Uploaded image for project: 'ZK Spreadsheet'
  1. ZK Spreadsheet
  2. ZSS-873

Import formula cache result from an Excel file

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Normal Normal
    • 3.7.0
    • 3.6.0
    • 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;
      	}
      }
      

            Jenkins Jenkins
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: