Smrf.NodeXL.ExcelTemplate.DynamicFilterUtil.TryGetNumericRange C# (CSharp) Method

TryGetNumericRange() private static method

private static TryGetNumericRange ( String sWorksheetName, ListColumn oColumn, Double &dMinimumCellValue, Double &dMaximumCellValue ) : System.Boolean
sWorksheetName String
oColumn ListColumn
dMinimumCellValue Double
dMaximumCellValue Double
return System.Boolean
    TryGetNumericRange
    (
        String sWorksheetName,
        ListColumn oColumn,
        out Double dMinimumCellValue,
        out Double dMaximumCellValue
    )
    {
        Debug.Assert( !String.IsNullOrEmpty(sWorksheetName) );
        Debug.Assert(oColumn != null);
        Debug.Assert(oColumn.DataBodyRange != null);

        dMinimumCellValue = dMaximumCellValue = Double.MinValue;

        Application oApplication = oColumn.Application;

        String sFunctionCall = String.Format(

            "=MIN({0}!{1})"
            ,
            sWorksheetName,
            ExcelUtil.GetRangeAddress(oColumn.DataBodyRange)
            );

        if ( !ExcelUtil.TryEvaluateDoubleFunction(oApplication, sFunctionCall,
            out dMinimumCellValue) )
        {
            return (false);
        }

        sFunctionCall = sFunctionCall.Replace("MIN", "MAX");

        if ( !ExcelUtil.TryEvaluateDoubleFunction(oApplication, sFunctionCall,
            out dMaximumCellValue) )
        {
            return (false);
        }

        return (dMaximumCellValue > dMinimumCellValue);
    }