You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AutoFilter.java 3.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.ss.usermodel;
  16. /**
  17. * Represents autofiltering for the specified worksheet.
  18. *
  19. * <p>
  20. * Filtering data is a quick and easy way to find and work with a subset of data in a range of cells or table.
  21. * For example, you can filter to see only the values that you specify, filter to see the top or bottom values,
  22. * or filter to quickly see duplicate values.
  23. * </p>
  24. *
  25. * TODO YK: For now (Aug 2010) POI only supports setting a basic autofilter on a range of cells.
  26. * In future, when we support more auto-filter functions like custom criteria, sort, etc. we will add
  27. * corresponding methods to this interface.
  28. */
  29. public interface AutoFilter {
  30. /**
  31. * Apply a custom filter
  32. *
  33. * <p>
  34. * A custom AutoFilter specifies an operator and a value.
  35. * There can be at most two customFilters specified, and in that case the parent element
  36. * specifies whether the two conditions are joined by 'and' or 'or'. For any cells whose
  37. * values do not meet the specified criteria, the corresponding rows shall be hidden from
  38. * view when the filter is applied.
  39. * </p>
  40. *
  41. * <p>
  42. * Example:
  43. * <blockquote><pre>
  44. * AutoFilter filter = sheet.setAutoFilter(CellRangeAddress.valueOf("A1:F200"));
  45. * filter.applyFilter(0, FilterOperator.GreaterThanOrEqual", "0.2");
  46. * filter.applyFilter(1, FilterOperator.LessThanOrEqual"", "0.5");
  47. * </pre></blockquote>
  48. * </p>
  49. *
  50. * @param columnIndex 0-based column index
  51. * @param operator the operator to apply
  52. * @param criteria top or bottom value used in the filter criteria.
  53. *
  54. * TODO YK: think how to combine AutoFilter with with DataValidationConstraint, they are really close relatives
  55. * void applyFilter(int columnIndex, FilterOperator operator, String criteria);
  56. */
  57. /**
  58. * Apply a filter against a list of values
  59. *
  60. * <p>
  61. * Example:
  62. * <blockquote><pre>
  63. * AutoFilter filter = sheet.setAutoFilter(CellRangeAddress.valueOf("A1:F200"));
  64. * filter.applyFilter(0, "apache", "poi", "java", "api");
  65. * </pre></blockquote>
  66. * </p>
  67. *
  68. * @param columnIndex 0-based column index
  69. * @param values the filter values
  70. *
  71. * void applyFilter(int columnIndex, String ... values);
  72. */
  73. }