Show / Hide Table of Contents

Filter Table Bottom 40%

Output: FilterTableBottom40Percent.xlsx

public void Run()
{
    var workbook = new Workbook();
    var worksheet = workbook.Worksheets[0];
    worksheet["A1"].Value = "Name";
    worksheet["B1"].Value = "Number";

    worksheet.GetRange("A2:A11").SetValue(new[] { "Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "Item8", "Item9", "Item10" });
    worksheet.GetRange("B2:B11").SetValue(new[] { 10,20,30,40,50,60,70,80,90,100 });

    var table = worksheet.Tables.Add("A1:B11", true);
    table.Id = 2;
    table.Name = "Table1";
    table.DisplayName = "Table1";
    table.HeaderRowCellStyle = "Heading_3";
    table.TotalsRowVisible = false;

    table.Filter();

    var filter1 = new DRIT.Spreadsheet.Filter();
    filter1.Top10 = new Top10Filter();
    filter1.Top10.FilterValue = 3;
    filter1.Top10.Value = 40;
    filter1.Top10.Percent = true;
    filter1.Top10.Top = false;
    table.AutoFilter.Columns.Add(1, filter1);
    table.AutoFilter.Apply();
            
    workbook.SaveAs("FilterTableBottom40Percent.xlsx");
}
Back to top Generated by DocFX