Syncfusion.XlsIO.Base
Example 


IsTop Property

True if the Top 10 AutoFilter shows the top items; False if it shows the bottom items.
Syntax
'Declaration
 
Property IsTop As Boolean
'Usage
 
Dim instance As IAutoFilter
Dim value As Boolean
 
instance.IsTop = value
 
value = instance.IsTop
bool IsTop {get; set;}
Example
The following code illustrates how to set the IsTop property.
using Syncfusion.XlsIO;
            
class Program
{
    static void Main()
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
            //Create worksheet
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet worksheet = workbook.Worksheets[0];
            
            //Load data
            worksheet["A1"].Text = "Top 10";
            worksheet["A2"].Number = 7;
            worksheet["A3"].Number = 1;
            worksheet["A4"].Number = 8;
            worksheet["A5"].Number = 2;
            worksheet["A6"].Number = 3;
            worksheet["A7"].Number = 9;
            worksheet["A8"].Number = 15;
            worksheet["A9"].Number = 19;
            worksheet["A10"].Number = 23;
            worksheet["A11"].Number = 42;
            worksheet["A12"].Number = 5;
            worksheet["A13"].Number = 7;
            worksheet["A14"].Number = 12;
            worksheet["A15"].Number = 16;
            worksheet["A16"].Number = 22;
            worksheet["A17"].Number = 33;
            worksheet["A18"].Number = 25;
            worksheet["A19"].Number = 30;
            worksheet["A20"].Number = 38;
            worksheet["A21"].Number = 6;   
            
            //Create style for table number format
            IStyle style1 = workbook.Styles.Add("CurrencyFormat");
            style1.NumberFormat = "_($* #,##0.00_);_($* (#,##0.00);_($* \" - \"??_);_(@_)";
            
            //Apply number format
            worksheet["B2:C8"].CellStyleName = "CurrencyFormat";
            
            //Create filter
            IAutoFilters filters = worksheet.AutoFilters;
            filters.FilterRange = worksheet["A1:A21"];
            IAutoFilter filter = filters[0];
            
            //Set top
            filter.IsTop = false;
            
            //Set top 10 number
            filter.Top10Number = 5;
            
            //Apply AutoFit
            worksheet.UsedRange.AutofitColumns();
            
            //Save and Dispose
            workbook.SaveAs("Filters.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.2460.0.34

See Also