AutoFilter class

AutoFilter class

Represents autofiltering for the specified worksheet.

The AutoFilter type exposes the following members:

Properties

PropertyDescription
sorterGets the data sorter.
rangeRepresents the range to which the specified AutoFilter applies.
show_filter_buttonIndicates whether the AutoFilter button for this column is visible.
filter_columnsGets the collection of the filter columns.

Methods

MethodDescription
remove_filterRemoves a filter for a filter column.
remove_filterRemove the specific filter.
customFilters a list with a custom criteria.
customFilters a list with custom criteria.
refreshRefresh auto filters to hide or unhide the rows.
refreshGets all hidden rows’ indexes.
set_rangeSets the range to which the specified AutoFilter applies.
get_cell_areaGets the CellArea where the specified AutoFilter applies to.
add_filterAdds a filter for a filter column.
add_date_filterAdds a date filter.
remove_date_filterRemoves a date filter.
filterFilters a list with specified criteria.
filter_top10Filter the top 10 item in the list
dynamic_filterAdds a dynamic filter.
add_font_color_filterAdds a font color filter.
add_fill_color_filterAdds a fill color filter.
add_icon_filterAdds an icon filter.
match_blanksMatch all blank cell in the list.
match_non_blanksMatch all not blank cell in the list.
show_allUnhide all rows.

Example

from aspose.cells import Workbook

# Creating a file stream containing the Excel file to be opened
# Instantiating a Workbook object
workbook = Workbook("template.xlsx")
# Accessing the first worksheet in the Excel file
worksheet = workbook.worksheets[0]
# Creating AutoFilter by giving the cells range of the heading row
worksheet.auto_filter.range = "A1:B1"
# Filtering columns with specified values
worksheet.auto_filter.filter(1, "Bananas")
# Saving the modified Excel file.
workbook.save("output.xls")

See Also