Smrf.NodeXL.ExcelTemplate.DynamicFilterDialog.AddDynamicFilterFormulaToTable C# (CSharp) Метод

AddDynamicFilterFormulaToTable() защищенный Метод

protected AddDynamicFilterFormulaToTable ( String sWorksheetName, String sTableName, String sDynamicFilterFormula ) : Microsoft.Office.Interop.Excel.Range
sWorksheetName String
sTableName String
sDynamicFilterFormula String
Результат Microsoft.Office.Interop.Excel.Range
    AddDynamicFilterFormulaToTable
    (
        String sWorksheetName,
        String sTableName,
        String sDynamicFilterFormula
    )
    {
        Debug.Assert( !String.IsNullOrEmpty(sWorksheetName) );
        Debug.Assert( !String.IsNullOrEmpty(sTableName) );
        Debug.Assert( !String.IsNullOrEmpty(sDynamicFilterFormula) );
        AssertValid();

        // Get the table.

        Microsoft.Office.Interop.Excel.ListObject oTable;

        if (!ExcelTableUtil.TryGetTable(m_oWorkbook, sWorksheetName, sTableName,
                out oTable) )
        {
            throw new WorkbookFormatException(
                "Can't find a required table."
                );
        }

        // Add a dynamic filter column to the table if it isn't already there.

        Microsoft.Office.Interop.Excel.Range oDynamicFilterColumnData =
            AddDynamicFilterTableColumn(oTable);

        // Check whether the entire table is empty.  (The default state of a
        // table in a new workbook is one empty row.)

        if (!ExcelTableUtil.VisibleTableRangeIsEmpty(oTable))
        {
            // Set every cell to the filter formula.

            oDynamicFilterColumnData.set_Value(Missing.Value,
                sDynamicFilterFormula);
        }

        return (oDynamicFilterColumnData);
    }