Visual Basic (Declaration) | |
---|---|
Public Sub AutoFilterColumn( _ ByVal column As Integer, _ ByVal filterString As String, _ ByVal filterItemIndex As Integer _ ) |
Visual Basic (Usage) | Copy Code |
---|---|
Dim instance As SheetView Dim column As Integer Dim filterString As String Dim filterItemIndex As Integer instance.AutoFilterColumn(column, filterString, filterItemIndex) |
C# | |
---|---|
public void AutoFilterColumn( int column, string filterString, int filterItemIndex ) |
Parameters
- column
- Column index
- filterString
- Filter string
- filterItemIndex
- Filter item index
The third parameter, filterItemIndex, checks whether the index is 0 or not; it checks whether the "All" item is selected (which is always the first item in the list and so always has index of 0) or not. This uses an index (integer) as opposed to a boolean because it is exposed as a public method and the column may or may not be selected. If the filter is a single item (or none), then the string in the second parameter, filterString, is enough information. The filterString parameter should be an exact match for one of the strings returned by the GetDropDownFilterItems method for the column.
This example filters the second column.
C# | Copy Code |
---|---|
fpSpread1.ActiveSheet.Columns[2].AllowAutoFilter = true; fpSpread1.ActiveSheet.AutoFilterColumn(2, "London", 1); |
Visual Basic | Copy Code |
---|---|
FpSpread1.ActiveSheet.Columns(2).AllowAutoFilter = True FpSpread1.ActiveSheet.AutoFilterColumn(2, "London", 1) |
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
Reference
SheetView ClassSheetView Members
HideRowFilter Class
StyleRowFilter Class