java.lang.Objectcom.aspose.cells.AutoFilter
public class AutoFilter
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 | ||
---|---|---|
FilterColumnCollection | getFilterColumnCollection() | |
Gets the collection of the filer columns. | ||
java.lang.String | getRange() | |
void | setRange(java.lang.String value) | |
Represents the range to which the specified AutoFilter applies. | ||
DataSorter | getSorter() | |
Gets the data sorter. |
Method Summary | ||
---|---|---|
void | addDateFilter(int fieldIndex, int dateTimeGroupingType, int year, int month, int day, int hour, int minute, int second) | |
Adds a date filter. | ||
void | addFillColorFilter(int fieldIndex, int pattern, CellsColor foregroundColor, CellsColor backgroundColor) | |
Adds a fill color filter. | ||
void | addFilter(int fieldIndex, java.lang.String criteria) | |
Adds a filter for a filter column. | ||
void | addFontColorFilter(int fieldIndex, CellsColor color) | |
Adds a font color filter. | ||
void | addIconFilter(int fieldIndex, int iconSetType, int iconId) | |
Adds an icon filter. | ||
void | custom(int fieldIndex, int operatorType1, java.lang.Object criteria1) | |
Filters a list with a custom criteria. | ||
void | custom(int fieldIndex, int operatorType1, java.lang.Object criteria1, boolean isAnd, int operatorType2, java.lang.Object criteria2) | |
Filters a list with custom criterias. | ||
void | dynamicFilter(int fieldIndex, int dynamicFilterType) | |
Adds a dynamic filter. | ||
void | filter(int fieldIndex, java.lang.String criteria) | |
Filters a list with specified criteria. | ||
void | filterTop10(int fieldIndex, boolean isTop, boolean isPercent, int itemCount) | |
Filter the top 10 item in the list | ||
void | matchBlanks(int fieldIndex) | |
Match all blank cell in the list. | ||
void | matchNonBlanks(int fieldIndex) | |
Match all not blank cell in the list. | ||
void | refresh() | |
Refresh auto filters to hide or unhide the rows. | ||
void | removeDateFilter(int fieldIndex, int dateTimeGroupingType, int year, int month, int day, int hour, int minute, int second) | |
Removes a date filter. | ||
void | removeFilter(int fieldIndex) | |
Remove the specific filter. | ||
void | removeFilter(int fieldIndex, java.lang.String criteria) | |
Removes a filter for a filter column. | ||
void | setRange(int row, int startColumn, int endColumn) | |
Sets the range to which the specified AutoFilter applies. | ||
void | showAll() | |
Unhide all rows. |
Property Getters/Setters Detail |
---|
getSorter | |
public DataSorter getSorter() |
getRange/setRange | |
public java.lang.String getRange() / public void setRange(java.lang.String value) |
getFilterColumnCollection | |
public FilterColumnCollection getFilterColumnCollection() |
Method Detail |
---|
setRange | |
public void setRange(int row, int startColumn, int endColumn) |
row
- Row index.startColumn
- Start column index.endColumn
- End column Index.addFilter | |
public void addFilter(int fieldIndex, java.lang.String criteria) |
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 void addDateFilter(int fieldIndex, int dateTimeGroupingType, int year, int month, int day, int hour, int minute, int second) |
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 year
- The year.month
- The month.day
- The day.hour
- The hour.minute
- The minute.second
- The second.removeDateFilter | |
public void removeDateFilter(int fieldIndex, int dateTimeGroupingType, int year, int month, int day, int hour, int minute, int second) |
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 year
- The year.month
- The month.day
- The day.hour
- The hour.minute
- The minute.second
- The second.removeFilter | |
public void removeFilter(int fieldIndex, java.lang.String criteria) |
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 void filter(int fieldIndex, java.lang.String criteria) |
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 void filterTop10(int fieldIndex, boolean isTop, boolean isPercent, int itemCount) |
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 bottomisPercent
- Indicates whether the items is percent or count itemCount
- The item countdynamicFilter | |
public void dynamicFilter(int fieldIndex, int dynamicFilterType) |
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 addFontColorFilter | |
public void addFontColorFilter(int fieldIndex, CellsColor color) |
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 addFillColorFilter | |
public void addFillColorFilter(int fieldIndex, int pattern, CellsColor foregroundColor, CellsColor backgroundColor) |
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 foregroundColor
- The foreground color.backgroundColor
- The background color.addIconFilter | |
public void addIconFilter(int fieldIndex, int iconSetType, int iconId) |
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 iconId
- The icon id.matchBlanks | |
public void matchBlanks(int fieldIndex) |
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 void matchNonBlanks(int fieldIndex) |
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 void custom(int fieldIndex, int operatorType1, java.lang.Object criteria1) |
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 criteria1
- The custom criteriacustom | |
public void custom(int fieldIndex, int operatorType1, java.lang.Object criteria1, boolean isAnd, int operatorType2, java.lang.Object criteria2) |
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 criteria1
- The custom criteriaisAnd
- operatorType2
- A criteria2
- The custom criteriashowAll | |
public void showAll() |
removeFilter | |
public void removeFilter(int fieldIndex) |
fieldIndex
- The specific filter indexrefresh | |
public void refresh() |