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.

Table.java 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. import java.util.regex.Pattern;
  17. /**
  18. * XSSF Only!
  19. * High level abstraction of table in a workbook.
  20. */
  21. public interface Table {
  22. /**
  23. * Regular expression matching a Structured Reference (Table syntax) for XSSF table expressions.
  24. * Public for unit tests
  25. * @see <a href="https://support.office.com/en-us/article/Using-structured-references-with-Excel-tables-F5ED2452-2337-4F71-BED3-C8AE6D2B276E">
  26. * Excel Structured Reference Syntax
  27. * </a>
  28. */
  29. Pattern isStructuredReference = Pattern.compile("[a-zA-Z_\\\\][a-zA-Z0-9._]*\\[.*\\]");
  30. /**
  31. * Get the top-left column index relative to the sheet
  32. * @return table start column index on sheet
  33. */
  34. int getStartColIndex();
  35. /**
  36. * Get the top-left row index on the sheet
  37. * @return table start row index on sheet
  38. */
  39. int getStartRowIndex();
  40. /**
  41. * Get the bottom-right column index on the sheet
  42. * @return table end column index on sheet
  43. */
  44. int getEndColIndex();
  45. /**
  46. * Get the bottom-right row index
  47. * @return table end row index on sheet
  48. */
  49. int getEndRowIndex();
  50. /**
  51. * Get the name of the table.
  52. * @return table name
  53. */
  54. String getName();
  55. /**
  56. * Returns the index of a given named column in the table (names are case insensitive in XSSF).
  57. * Note this list is lazily loaded and cached for performance.
  58. * Changes to the underlying table structure are not reflected in later calls
  59. * unless <code>XSSFTable.updateHeaders()</code> is called to reset the cache.
  60. * @param columnHeader the column header name to get the table column index of
  61. * @return column index corresponding to <code>columnHeader</code>
  62. */
  63. int findColumnIndex(String columnHeader);
  64. /**
  65. * Returns the sheet name that the table belongs to.
  66. */
  67. String getSheetName();
  68. /**
  69. * Returns true iff the table has a 'Totals' row
  70. */
  71. boolean isHasTotalsRow();
  72. /**
  73. * @return TableStyleInfo for this instance
  74. * @since 3.17 beta 1
  75. */
  76. TableStyleInfo getStyle();
  77. }