0

I have found that you can use this syntax to filter a workbook with EPPlus range.AutoFilter = true;

But I have not seen if/how I can pass in a filter parameter. For example, using the Excel Interop - I would use

range.AutoFilter(1, range.Cells[2, 1].Value);

Does EPPlus have the equivalent of such?

EDIT
What I am after here is the ability to copy all rows (including headers) from a master worksheet to sub-worksheets.

For example, if the master worksheet looks like this

Name   A   B   C   D
Joe    XX  XX  XX  XX
Joe    XX  XX  XX  XX
Joe    XX  XX  XX  XX
Jack   AA  AA  AA  AA
Jack   AA  AA  AA  AA
Jim    BB  BB  BB  BB

The steps I would need to occur are

1) Create a new worksheet, name it Joe
2) Copy all data for Joe (including headers to new worksheet)
3) Repeat process for all names in the list

I have this working with Excel Interop, but of course using this course is SLOW!

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
  • Generally, no, Epplus does not have the ability to apply native excel filters - it just generates raw xml. Best you can do is mimic the filter in code. See if this helps: http://stackoverflow.com/questions/33398255/create-advanced-filter/33412586#33412586 or this: http://stackoverflow.com/questions/32723483/adding-a-specific-autofilter-on-a-column/32766493#32766493 – Ernie S Feb 13 '17 at 01:43
  • Since my examples above have different values in the seperate columns the syntax just duplicates the worksheet.... var rows = ws2.Cells .GroupBy(cell => cell.Start.Row) //.Skip(1) //Exclude header .Select(cg => cg.Select(c => c.Value).ToArray()) .Distinct(new ArrayComparer()) .ToArray(); – StarsFlyFree FromCozyNights Feb 13 '17 at 03:43

0 Answers0