Uploaded image for project: 'Keikai'
  1. Keikai
  2. KEIKAI-525

MATCH() with an invalid range will be ignored after exporting

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 5.10.0
    • 5.8.1
    • None
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      1. import the attached file
      2. export to xlsx
      3. check D5 in the exported file

      Current Result

      D5 is blank

      Expected Result

      D5 contains the original formula

      Debug Information

      • Because of the runtime exception below
        2021-10-04 14:47:30 [ERROR] FormulaEngineImpl:491 - Unexpected eval type (org.zkoss.poi.ss.formula.eval.ErrorEval) when eval MATCH(40,INDIRECT(A7),-1)
        java.lang.RuntimeException: Unexpected eval type (org.zkoss.poi.ss.formula.eval.ErrorEval)
        	at org.zkoss.poi.ss.formula.functions.Match.evaluateLookupRange(Match.java:168)
        	at org.zkoss.poi.ss.formula.functions.Match.eval(Match.java:111)
        	at org.zkoss.poi.ss.formula.functions.Match.evaluate(Match.java:91)
        

        Keikai doesn't export the formula

        abstract public class AbstractExcelExporter extends AbstractExporter {
        
        	protected void exportRow(SSheet sheet, Sheet poiSheet, SRow row) {
        ...
        		case FORMULA:
        			if(cell.getFormulaResultType()==CellType.ERROR && cell.getErrorValue().getCode() == ErrorValue.INVALID_FORMULA){//ZSS-891
        				//ignore the value of this cell, excel doesn't allow invalid formulas (parsing error).
        			}else{
        ...
        }
        
      • For all Function in keikai, they should return ErrorEval first, then consider to throw EvaluationException instead of RuntimeException

            jumperchen jumperchen
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: