C
C#13mo ago
Smiler

❔ Excel column filter

Using VSTO/interop I'm trying to filter an excel sheet based on a column containing integer IDs. My plugin collects an array of integers and then tries to filter the column:
vstoSheet.Range["A1:A10"].AutoFilter(1, new int[]{1,2,3}, Excel.XlAutoFilterOperator.xlFilterValues, System.Type.Missing, true);
vstoSheet.Range["A1:A10"].AutoFilter(1, new int[]{1,2,3}, Excel.XlAutoFilterOperator.xlFilterValues, System.Type.Missing, true);
I've tried to reason about why it doesn't work but every possible combination of options I could think of just resulted in all elements being filtered. The expected behaviour is to only have the elements in the provided list being displayed.
2 Replies
Smiler
Smiler13mo ago
Holy moly I've solved it. You need to use a string array even if your datatype is an int. -5 hours
Accord
Accord13mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.