We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Turn On Filtering

Hi all,


Is there an example how I can turn on the filter for some cells (e.g first row).

Thank you.

Aspose,Cells. 8.4.1

Hi,

Thanks for your posting and using Aspose.Cells.

Please try the following code which illustrates how to turn on the filtering on a range of cells. I have also attached the source excel file used in this code and output excel file generated by it as well as screenshot showing the filters for a reference.

Java
String filePath = “D:\Downloads\source.xlsx”;

Workbook workbook = new Workbook(filePath);

Worksheet worksheet = workbook.getWorksheets().get(0);

worksheet.getAutoFilter().setRange(“D3:H3”);

workbook.save(“output.xlsx”);

Thank you. Got it!


worksheet.getAutoFilter().setRange(int row, int startColumn, int endColumn)

Hi,

Thanks for your posting and using Aspose.Cells.

It is great to know that you found the relevant and equivalent method in Aspose.Cells for Java APIs too which fits your needs. Let us know if you encounter any other issue, we will be glad to look into it and help you asap.