com.aspose.cells
Class AutoFilter

java.lang.Object
    extended by com.aspose.cells.AutoFilter

public abstract class AutoFilter 
extends java.lang.Object

Represents autofiltering for the specified worksheet.

Example:

//Instantiating a Workbook object
Workbook workbook = new Workbook("C:\\book1.xls");
//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("A1:B1");
//Filtering columns with specified values
worksheet.getAutoFilter().filter(1, "Bananas");
//Saving the modified Excel file.
workbook.save("C:\\output.xls");

Property Getters/Setters Summary
abstract FilterColumnCollectiongetFilterColumns()
           Gets the collection of the filter columns.
abstract java.lang.StringgetRange()
abstract voidsetRange(java.lang.String value)
           Represents the range to which the specified AutoFilter applies.
abstract DataSortergetSorter()
           Gets the data sorter.
 
Method Summary
abstract voidaddDateFilter(int fieldIndex, int dateTimeGroupingType, int year, int month, int day, int hour, int minute, int second)
           Adds a date filter.
abstract voidaddFillColorFilter(int fieldIndex, int pattern, CellsColor foregroundColor, CellsColor backgroundColor)
           Adds a fill color filter.
abstract voidaddFilter(int fieldIndex, java.lang.String criteria)
           Adds a filter for a filter column.
abstract voidaddFontColorFilter(int fieldIndex, CellsColor color)
           Adds a font color filter.
abstract voidaddIconFilter(int fieldIndex, int iconSetType, int iconId)
           Adds an icon filter.
abstract voidcustom(int fieldIndex, int operatorType1, java.lang.Object criteria1)
           Filters a list with a custom criteria.
abstract voidcustom(int fieldIndex, int operatorType1, java.lang.Object criteria1, boolean isAnd, int operatorType2, java.lang.Object criteria2)
           Filters a list with custom criteria.
abstract voiddynamicFilter(int fieldIndex, int dynamicFilterType)
           Adds a dynamic filter.
abstract voidfilter(int fieldIndex, java.lang.String criteria)
           Filters a list with specified criteria.
abstract voidfilterTop10(int fieldIndex, boolean isTop, boolean isPercent, int itemCount)
           Filter the top 10 item in the list
abstract voidmatchBlanks(int fieldIndex)
           Match all blank cell in the list.
abstract voidmatchNonBlanks(int fieldIndex)
           Match all not blank cell in the list.
abstract voidrefresh()
           Refresh auto filters to hide or unhide the rows.
abstract voidremoveDateFilter(int fieldIndex, int dateTimeGroupingType, int year, int month, int day, int hour, int minute, int second)
           Removes a date filter.
abstract voidremoveFilter(int fieldIndex)
           Remove the specific filter.
abstract voidremoveFilter(int fieldIndex, java.lang.String criteria)
           Removes a filter for a filter column.
abstract voidsetRange(int row, int startColumn, int endColumn)
           Sets the range to which the specified AutoFilter applies.
abstract voidshowAll()
           Unhide all rows.
 

Property Getters/Setters Detail

getSorter

public abstract DataSorter getSorter()
Gets the data sorter.

getRange/setRange

public abstract java.lang.String getRange() / public abstract void setRange(java.lang.String value)
Represents the range to which the specified AutoFilter applies.

getFilterColumns

public abstract FilterColumnCollection getFilterColumns()
Gets the collection of the filter columns.

Method Detail

setRange

public abstract void setRange(int row, int startColumn, int endColumn)
Sets the range to which the specified AutoFilter applies.
Parameters:
row - Row index.
startColumn - Start column index.
endColumn - End column Index.

addFilter

public abstract void addFilter(int fieldIndex, java.lang.String criteria)
Adds a filter for a filter column. MS Excel 2007 supports multiple selection in a filter column.
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
criteria - The specified criteria (a string; for example, "101"). It only can be null or be one of the cells' value in this column.

addDateFilter

public abstract void addDateFilter(int fieldIndex, int dateTimeGroupingType, int year, int month, int day, int hour, int minute, int second)
Adds a date filter. If DateTimeGroupingType is Year, only the param year effects. If DateTiemGroupingType is Month, only the param year and month effect.
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
dateTimeGroupingType - A DateTimeGroupingType value. DateTimeGroupingType
year - The year.
month - The month.
day - The day.
hour - The hour.
minute - The minute.
second - The second.

removeDateFilter

public abstract void removeDateFilter(int fieldIndex, int dateTimeGroupingType, int year, int month, int day, int hour, int minute, int second)
Removes a date filter. If DateTimeGroupingType is Year, only the param year effects. If DateTiemGroupingType is Month, only the param year and month effect.
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
dateTimeGroupingType - A DateTimeGroupingType value. DateTimeGroupingType
year - The year.
month - The month.
day - The day.
hour - The hour.
minute - The minute.
second - The second.

removeFilter

public abstract void removeFilter(int fieldIndex, java.lang.String criteria)
Removes a filter for a filter column.
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
criteria - The specified criteria (a string; for example, "101"). It only can be null or be one of the cells' value in this column.

filter

public abstract void filter(int fieldIndex, java.lang.String criteria)
Filters a list with specified criteria. Aspose.Cells will remove all other filter setting on this field as Ms Excel 97-2003.
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
criteria - The specified criteria (a string; for example, "101").

filterTop10

public abstract void filterTop10(int fieldIndex, boolean isTop, boolean isPercent, int itemCount)
Filter the top 10 item in the list
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
isTop - Indicates whether filter from top or bottom
isPercent - Indicates whether the items is percent or count
itemCount - The item count

dynamicFilter

public abstract void dynamicFilter(int fieldIndex, int dynamicFilterType)
Adds a dynamic filter.
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
dynamicFilterType - A DynamicFilterType value. Dynamic filter type.

addFontColorFilter

public abstract void addFontColorFilter(int fieldIndex, CellsColor color)
Adds a font color filter.
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
color - The CellsColor object.

addFillColorFilter

public abstract void addFillColorFilter(int fieldIndex, int pattern, CellsColor foregroundColor, CellsColor backgroundColor)
Adds a fill color filter.
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
pattern - A BackgroundType value. The background pattern type.
foregroundColor - The foreground color.
backgroundColor - The background color.

addIconFilter

public abstract void addIconFilter(int fieldIndex, int iconSetType, int iconId)
Adds an icon filter. Only supports to add the icon filter. Not supports checking which row is visible if the filter is icon filter.
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
iconSetType - A IconSetType value. The icon set type.
iconId - The icon id.

matchBlanks

public abstract void matchBlanks(int fieldIndex)
Match all blank cell in the list.
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).

matchNonBlanks

public abstract void matchNonBlanks(int fieldIndex)
Match all not blank cell in the list.
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).

custom

public abstract void custom(int fieldIndex, int operatorType1, java.lang.Object criteria1)
Filters a list with a custom criteria.
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
operatorType1 - A FilterOperatorType value. The filter operator type
criteria1 - The custom criteria

custom

public abstract void custom(int fieldIndex, int operatorType1, java.lang.Object criteria1, boolean isAnd, int operatorType2, java.lang.Object criteria2)
Filters a list with custom criteria.
Parameters:
fieldIndex - The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
operatorType1 - A FilterOperatorType value. The filter operator type
criteria1 - The custom criteria
isAnd -
operatorType2 - A FilterOperatorType value. The filter operator type
criteria2 - The custom criteria

showAll

public abstract void showAll()
Unhide all rows.

removeFilter

public abstract void removeFilter(int fieldIndex)
Remove the specific filter.
Parameters:
fieldIndex - The specific filter index

refresh

public abstract void refresh()
Refresh auto filters to hide or unhide the rows.

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.