AutoFilter

Is there a way I can dynamically set autofilter for a specified cell or group of cells via code?

thanks,
-c

Hi, thanks for your consideration.

Currently Aspose.Excel only support autofilter in designer file.

We would REALLY appreciate it if you can add a method to Aspose Excel which would allow us to dynamically set autofilter for a particular column. Is there any chance? We are in the process of developing complicated reports which require this feature.

Thanks,
-Chi

Hi, Chi.

I will start to add a method to meet your need. But since this feature is difficult to implement, it will be available till 10/15 in my plan.

Thanks! again, we truly appreciate it.

-Chi

Dear Chi,

Please download hotfix 1.6.1.

You can use the following code to set autofilter in column 1 & 2.

sheet.AutoFilter.Name = “A1:B1”;

Sorry, mistyped.

sheet.AutoFilter.Range = “A1:B1”;

fantastic! i will download and try it today. thank you.

@Sponger,
We have replaced the Aspose.Excel library with an advanced version Aspose.Cells supporting all the latest versions of MS Excel. You can apply filters using this new library as well as shown in the following sample code:

// Opening the Excel file
Workbook workbook = new Workbook(dataDir + "book1.xls");

// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];

// Creating AutoFilter by giving the cells range of the heading row
worksheet.AutoFilter.Range = "A1:B1";

// Saving the modified Excel file
workbook.Save(dataDir + "output.out.xls");

For more details have a look at the following article:
Data Filtering

Download the latest version of Aspose.Cells for .NET from the following link:
Aspose.Cells for .NET (Latest Version)

You can download the latest demos here.