Skip to content

Commit ec314a8

Browse files
ES-975464 - Resolve the ReadMe file length issue in this sample repository
1 parent 92e2c12 commit ec314a8

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
1-
# how-to-clear-filter-while-importing-excel-into-wpf-spreadsheet
2-
This repository contains the sample which shows the how to clear the filter while importing sheet into wpf spreadsheet.
1+
# How to clear filter while importing excel into WPF Spreadsheet
32

4-
KB article - [how-to-clear-filter-while-importing-excel-into-wpf-spreadsheet](https://www.syncfusion.com/kb/11355/how-to-clear-filter-while-importing-a-excel-sheet-into-spreadsheet)
3+
This repository contains the sample which shows the how to clear the filter while importing sheet into [WPF Spreadsheet](https://www.syncfusion.com/wpf-controls/spreadsheet) (SfSpreadsheet).
4+
5+
`Spreadsheet` control loads the Excel workbook with filter’s if the filter applied before by user. You can clear the filter and load Excel workbook without filter by clearing the filter by setting [worksheet.AutoFilters.FilterRange](https://help.syncfusion.com/cr/wpf/Syncfusion.XlsIO.IAutoFilters.html#Syncfusion_XlsIO_IAutoFilters_FilterRange) property to null in [WorkbookLoaded](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.html#Syncfusion_UI_Xaml_Spreadsheet_SfSpreadsheet_WorkbookLoaded) event.
6+
7+
``` csharp
8+
//To clear the filter
9+
spreadsheet.WorkbookLoaded += Spreadsheet_WorkbookLoaded;
10+
11+
private void Spreadsheet_WorkbookLoaded(object sender, Syncfusion.UI.Xaml.Spreadsheet.Helpers.WorkbookLoadedEventArgs args)
12+
{
13+
foreach (var sheet in args.GridCollection)
14+
{
15+
if (sheet.Worksheet.AutoFilters.FilterRange != null)
16+
{
17+
sheet.Worksheet.AutoFilters.FilterRange = null;
18+
}
19+
}
20+
}
21+
```
22+
23+
![](https://www.syncfusion.com/uploads/user/kb/wpf/wpf-48664/wpf-48664_img1.png)

0 commit comments

Comments
 (0)