We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

XlsIO: Problem updating an existing AutoFilter.FilterRange in a worksheet ListObject

Thread ID:

Created:

Updated:

Platform:

Replies:

147323 Sep 5,2019 05:48 PM UTC Sep 6,2019 01:52 PM UTC WinForms 2
loading
Tags: XlsIO
Peter deNoyelles
Asked On September 5, 2019 06:05 PM UTC

So I'm having an issue with the worksheets existing AutoFilter not updating its FilterRange after I import data using worksheet.ImportDataTable.

In my use case, I have the worksheet that has an existing table that comes in as a worksheet.ListObject with an already defined AutoFilter.FilterRange set to worksheet.Range["B8:O9"];

I use worksheet.ImportDataTable(table, false, range.Row, range.Column, false); and the data is imported correctly. However, the AutoFilter.FilterRange is not updated to the new LastRow.

I've tried updating the range by using worksheet.ListObjects[0].AutoFilter.FilterRange = worksheet.Range["B8:O10"]; 
But the FilterRange doesn't update. I also noticed that the worksheet.ListObjects[0].Location was not updated to the last row of data either.

There's no AutoFilter on the worksheet object either. It seems to be isolated to just the ListObject table.

Is there any way around this? Should I remove the AutoFilter from the ListObject and move it to the worksheet object?

Peter deNoyelles
Replied On September 5, 2019 06:41 PM UTC

Answering my own question as I found a solution.

To update the AutoFilter.FilterRange of a ListObject, I had to update the ListObject.Location. This then automatically updated the AutoFilter.FilterRange of the ListObject.

Abirami Varadharajan [Syncfusion]
Replied On September 6, 2019 01:52 PM UTC

Hi Peter, 

Greetings from Syncfusion. 

As like you mentioned, updating the table range will update the filter range of the table.  

Please let us know if you need further assistance. 

Regards, 
Abirami 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon