Filtering on multiple texts for a column

Hi,

I have a query regarding filtering option for a column on multiple texts.

I am using the following code to filter column j on one value text1.

But if I want to filter on multiple vlaues for the same column how can i do it. Please provide some sample code.

AutoFilter autoFilter = workbook.getWorksheets().getSheet(1).getAutoFilter();

CellArea c = new CellArea("J1", "J1");

autoFilter.setRange(c);

autoFilter.filter(0, "text1")

Hi there,

Thank you for using Aspose products.

You can use the AutoFilter.addFilter() method to add multiple filtering cafeterias for a single column. Please have a look at below provide code snippet,

Java


Workbook book = new Workbook(myDir+“book1.xlsx”);
Worksheet sheet = book.getWorksheets().get(0);
//Create an AutoFilter object.
AutoFilter autofilter = sheet.getAutoFilter();
autofilter.setRange(“C2:C27”);
//Add as many filters as you like
autofilter.addFilter(0, “A”);
autofilter.addFilter(0, “B”);
book.save(myDir + “filtereddata.xls”);

Hi,

Thanks a loy for your response. This addFilter is added in latest version of aspose I think. Not sure from which version of aspose? We are using aspose-cells-2.5.3.1.jar and in that this addfilter is not available. Can you please let me know if any other option available in 2.5.3.1 version fior the smae. Also from which version onwards this addfilter method is avalialble?

Thanks in advance

Hi again,

Thank you for writing back.

I am afraid, I couldn’t find an alternative for addFilter method while using Aspose.Cells for Java 2.5.3. This feature was first provided with Aspose.Cells for Java 7.0.4, but you will not be able to download this version because the said release is more than one year old, and therefore according to the company policy it will not be accessible in Aspose download section.

We are sorry for your inconvenience.

Hi,

Thanks for the information. Please let us know when we can download the repective jar to use the addfilter method.

Hi,

I have attached the latest build of Aspose.Cells for Java 7.6.1.4 with this post. Please give it a try on your end, and feel free to write back in case you have further questions.