Skip to content

Commit 195df61

Browse files
authored
Merge pull request #3 from SyncfusionExamples/ES-975464
ES-975464 - Resolve the ReadMe file length issue in this sample repository
2 parents 6e852fb + 4dd1243 commit 195df61

2 files 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 a Excel Sheet 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/spreadsheet-editor-sdk/wpf-spreadsheet-editor) (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+
![Spreadsheet with filter cleared](SpreadsheetWithNoFilter.png)

SpreadsheetWithNoFilter.png

40.4 KB
Loading

0 commit comments

Comments
 (0)