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

Import formula cache result from an Excel file

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Done
    • Affects Version/s: 3.6.0
    • Fix Version/s: 3.7.0
    • Component/s: None
    • Security Level: Jimmy
    • Labels:
      None

      Description

      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;
      	}
      }
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: