Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 644 Bytes

Adding-an-AutoFilter-to-a-Range.md

File metadata and controls

21 lines (16 loc) · 644 Bytes

AutoFilter1.jpg

AutoFilter2.jpg

var wb = new XLWorkbook();
var ws = wb.Worksheets.Add("AutoFilter");
ws.Cell("A1").Value = "Names";
ws.Cell("A2").Value = "John";
ws.Cell("A3").Value = "Hank";
ws.Cell("A4").Value = "Dagny";

ws.RangeUsed().SetAutoFilter();

// Your can turn off the autofilter by:
// 1) worksheet.AutoFilter.Clear()
// 2) worksheet.SetAutoFilter(false)
// 3) Pick any range in the worksheet and call the above methods on the range

wb.SaveAs("AutoFilter.xlsx");