Beispiel #1
0
 private double CalculateWithSumRange(ExcelDataProvider.IRangeInfo range, string criteria, ExcelDataProvider.IRangeInfo sumRange, ParsingContext context)
 {
     var retVal = 0d;
     foreach(var cell in range)
     {
         if (_evaluator.Evaluate(cell.Value, criteria))
         {
             var or = cell.Row-range.Address._fromRow;
             var oc = cell.Column - range.Address._fromCol;
             if(sumRange.Address._fromRow+or <= sumRange.Address._toRow && 
                sumRange.Address._fromCol+oc <= sumRange.Address._toCol)
             {
                 var v = sumRange.GetOffset(or, oc);
                 if (v is ExcelErrorValue)
                 {
                     throw (new ExcelErrorValueException((ExcelErrorValue)v));
                 }
                 retVal += Util.ConvertUtil.GetValueDouble(v, true);
             }
         }
     }
     return retVal;
 }