Aspose::Cells::AutoFilter class

AutoFilter class

Represents autofiltering for the specified worksheet.

class AutoFilter

Methods

MethodDescription
AddDateFilter(int32_t fieldIndex, DateTimeGroupingType dateTimeGroupingType, int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second)Adds a date filter.
AddFillColorFilter(int32_t fieldIndex, BackgroundType pattern, const CellsColor& foregroundColor, const CellsColor& backgroundColor)Adds a fill color filter.
AddFilter(int32_t fieldIndex, const U16String& criteria)Adds a filter for a filter column.
AddFilter(int32_t fieldIndex, const char16_t* criteria)Adds a filter for a filter column.
AddFontColorFilter(int32_t fieldIndex, const CellsColor& color)Adds a font color filter.
AddIconFilter(int32_t fieldIndex, IconSetType iconSetType, int32_t iconId)Adds an icon filter.
AutoFilter(AutoFilter_Impl* impl)Constructs from an implementation object.
AutoFilter(const AutoFilter& src)Copy constructor.
Dynamic_Filter(int32_t fieldIndex, DynamicFilterType dynamicFilterType)Adds a dynamic filter.
Filter(int32_t fieldIndex, const U16String& criteria)Filters a list with specified criteria.
Filter(int32_t fieldIndex, const char16_t* criteria)Filters a list with specified criteria.
FilterTop10(int32_t fieldIndex, bool isTop, bool isPercent, int32_t itemCount)Filter the top 10 item in the list.
GetCellArea()Gets the CellArea where the specified AutoFilter applies to.
GetFilterColumns()Gets the collection of the filter columns.
GetRange()Represents the range to which the specified AutoFilter applies.
GetShowFilterButton()Indicates whether the AutoFilter button for this column is visible.
GetSorter()Gets the data sorter.
IsNull() constChecks whether the implementation object is nullptr.
MatchBlanks(int32_t fieldIndex)Match all blank cell in the list.
MatchNonBlanks(int32_t fieldIndex)Match all not blank cell in the list.
explicit operator bool() constoperator bool()
operator=(const AutoFilter& src)operator=
Refresh()Refresh auto filters to hide or unhide the rows.
Refresh(bool hideRows)Gets all hidden rows’ indexes.
RemoveDateFilter(int32_t fieldIndex, DateTimeGroupingType dateTimeGroupingType, int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second)Removes a date filter.
RemoveFilter(int32_t fieldIndex, const U16String& criteria)Removes a filter for a filter column.
RemoveFilter(int32_t fieldIndex, const char16_t* criteria)Removes a filter for a filter column.
RemoveFilter(int32_t fieldIndex)Remove the specific filter.
SetRange(int32_t row, int32_t startColumn, int32_t endColumn)Sets the range to which the specified AutoFilter applies.
SetRange(const U16String& value)Represents the range to which the specified AutoFilter applies.
SetRange(const char16_t* value)Represents the range to which the specified AutoFilter applies.
SetShowFilterButton(bool value)Indicates whether the AutoFilter button for this column is visible.
ShowAll()Unhide all rows.
~AutoFilter()Destructor.

Fields

FieldDescription
_implThe implementation object.

Examples

Aspose::Cells::Startup();
//Creating a file stream containing the Excel file to be opened
//Instantiating a Workbook object
Workbook workbook(u"template.xlsx");
//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.GetWorksheets().Get(0);
//Creating AutoFilter by giving the cells range of the heading row
worksheet.GetAutoFilter().SetRange(u"A1:B1");
//Filtering columns with specified values
worksheet.GetAutoFilter().Filter(1, u"Bananas");
//Saving the modified Excel file.
workbook.Save(u"output.xls");
Aspose::Cells::Cleanup();

See Also