ITabAutoFilter.Range

Syntax

Range: ITabRange;

Description

The Range property determines the table area where the filter will be set.

Example

Executing the example requires a form with the buttons on it named Button1, Button2, Button3, Button4, the TabSheetBox component and the UiTabSheet component named UiTabSheet1 which is used as a data source for the TabSheetBox component.

Class OBJ3592Form: Form
    Button1: Button;
    Button2: Button;
    Button3: Button;
    Button4: Button;
    TabSheetBox1: TabSheetBox;
    UiTabSheet1: UiTabSheet;
    TSheet: ITabSheet;
    TRange: ITabRange;
    AutoFilter: ITabAutoFilter;
    Stream: IIOStream;
Sub OBJ3592FormOnCreate(Sender: Object; Args: IEventArgs);
Begin
    TSheet := UiTabSheet1.TabSheet; 
    TRange:= TSheet.View.Selection.Range;
    AutoFilter := TSheet.View.AutoFilter;
    Stream := 
New MemoryStream.Create;
End Sub OBJ3592FormOnCreate;
    
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    
Begin       
        
// Enable autofilter
        AutoFilter.Range := TRange;
        AutoFilter.Enabled := 
True;
End Sub Button1OnClick;

Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
    
Begin       
        
//Save
        AutoFilter.Save(stream);
End Sub Button2OnClick;

Sub Button3OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
        
// Restore
        Stream.Position := 0;
        AutoFilter.Load(stream);
End Sub Button3OnClick;

Sub Button4OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
        
// Clear filter
        AutoFilter.Enabled := False;
End Sub Button4OnClick;

End Class OBJ3592Form;

To execute the example 

  1. Select the range and click the Button1 to enable autofilter.

  2. Click the Button2 to save autofilter.

  3. Click the Button4 to clear autofilter.

  4. Click the Button3 to restore autofilter.

See also:

ITabAutoFilter