Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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.xwpf.usermodel;
  16. import java.util.List;
  17. import org.apache.poi.ooxml.POIXMLDocumentPart;
  18. import org.apache.xmlbeans.XmlCursor;
  19. import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
  20. import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl;
  21. import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
  22. /**
  23. * <p>An IBody represents the different parts of the document which
  24. * can contain collections of Paragraphs and Tables. It provides a
  25. * common way to work with these and their contents.</p>
  26. * <p>Typically, this is something like a XWPFDocument, or one of
  27. * the parts in it like XWPFHeader, XWPFFooter, XWPFTableCell
  28. * </p>
  29. */
  30. public interface IBody {
  31. /**
  32. * returns the Part, to which the body belongs, which you need for adding relationship to other parts
  33. * Actually it is needed of the class XWPFTableCell. Because you have to know to which part the tableCell
  34. * belongs.
  35. *
  36. * @return the Part, to which the body belongs
  37. */
  38. POIXMLDocumentPart getPart();
  39. /**
  40. * get the PartType of the body, for example
  41. * DOCUMENT, HEADER, FOOTER, FOOTNOTE,
  42. *
  43. * @return the PartType of the body
  44. */
  45. BodyType getPartType();
  46. /**
  47. * Returns an Iterator with paragraphs and tables,
  48. * in the order that they occur in the text.
  49. */
  50. List<IBodyElement> getBodyElements();
  51. /**
  52. * Returns the paragraph(s) that holds
  53. * the text of the header or footer.
  54. */
  55. List<XWPFParagraph> getParagraphs();
  56. /**
  57. * Return the table(s) that holds the text
  58. * of the IBodyPart, for complex cases
  59. * where a paragraph isn't used.
  60. */
  61. List<XWPFTable> getTables();
  62. /**
  63. * Returns the paragraph corresponding to the provided {@link CTP}.
  64. *
  65. * @param p is instance of CTP and is searching for an XWPFParagraph
  66. * @return The paragraph corresponding to the {@link CTP}, or {@code null} if there is no corresponding paragraph in
  67. * this body.
  68. */
  69. XWPFParagraph getParagraph(CTP p);
  70. /**
  71. * if there is a corresponding {@link XWPFTable} of the parameter ctTable in the tableList of this header
  72. * the method will return this table
  73. * if there is no corresponding {@link XWPFTable} the method will return null
  74. */
  75. XWPFTable getTable(CTTbl ctTable);
  76. /**
  77. * Returns the paragraph that of position pos
  78. */
  79. XWPFParagraph getParagraphArray(int pos);
  80. /**
  81. * Returns the table at position pos
  82. */
  83. XWPFTable getTableArray(int pos);
  84. /**
  85. * inserts a new paragraph at position of the cursor
  86. */
  87. XWPFParagraph insertNewParagraph(XmlCursor cursor);
  88. /**
  89. * inserts a new Table at the cursor position.
  90. */
  91. XWPFTable insertNewTbl(XmlCursor cursor);
  92. /**
  93. * inserts a new Table at position pos
  94. */
  95. void insertTable(int pos, XWPFTable table);
  96. /**
  97. * returns the TableCell to which the Table belongs
  98. */
  99. XWPFTableCell getTableCell(CTTc cell);
  100. /**
  101. * Return XWPFDocument
  102. */
  103. XWPFDocument getXWPFDocument();
  104. }