poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 62040] New: Quotient.evaluate function does not accept cell refences
Date Tue, 23 Jan 2018 21:02:13 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=62040

            Bug ID: 62040
           Summary: Quotient.evaluate function does not accept cell
                    refences
           Product: POI
           Version: 3.17-FINAL
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SS Common
          Assignee: dev@poi.apache.org
          Reporter: cquezel@gmail.com
  Target Milestone: ---

I think adding OperandResolver.getSingleValue for the numerator and denominator
might solvce the problem.


    @Override
        public ValueEval evaluate(int srcRowIndex, int srcColumnIndex,
ValueEval venumerator, ValueEval vedenominator) {

        double enumerator = 0;
        try {
                        ValueEval ve =
OperandResolver.getSingleValue(venumerator, srcRowIndex, srcColumnIndex); //
added this line
            enumerator = OperandResolver.coerceValueToDouble(ve);
        } catch (EvaluationException e) {
            return ErrorEval.VALUE_INVALID;
        }

        double denominator = 0;
        try {
                        ValueEval ve =
OperandResolver.getSingleValue(vedenominator, srcRowIndex, srcColumnIndex); //
added this line
            denominator = OperandResolver.coerceValueToDouble(ve);
        } catch (EvaluationException e) {
            return ErrorEval.VALUE_INVALID;
        }

        if (denominator == 0) {
            return ErrorEval.DIV_ZERO;
        }

        return new NumberEval((int)(enumerator / denominator));
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message