public List<XWPFTable> getTables();
/**
- * if there is a corresponding {@link XWPFParagraph} of the parameter ctTable in the paragraphList of this header or footer
- * the method will return this paragraph
- * if there is no corresponding {@link XWPFParagraph} the method will return null
+ * Returns the paragraph corresponding to the provided {@link CTP}.
*
* @param p is instance of CTP and is searching for an XWPFParagraph
- * @return null if there is no XWPFParagraph with an corresponding CTPparagraph in the paragraphList of this header or footer
- * XWPFParagraph with the correspondig CTP p
+ * @return The paragraph corresponding to the {@link CTP}, or {@code null} if there is no corresponding paragraph in
+ * this body.
*/
public XWPFParagraph getParagraph(CTP p);
XWPFSDT c = new XWPFSDT((CTSdtBlock) o, this);
bodyElements.add(c);
}
-
+
}
cursor.dispose();
}
i++;
}
tables.add(i, table);
-
+
}
/**
return null;
}
- /**
- * if there is a corresponding {@link XWPFParagraph} of the parameter p in the paragraphList of this header or footer
- * the method will return that paragraph, otherwise the method will return null.
- *
- * @param p The CTP paragraph to find the corresponding {@link XWPFParagraph} for.
- * @return The {@link XWPFParagraph} that corresponds to the CTP paragraph in the paragraph
- * list of this footnote or null if no paragraph is found.
- * @see org.apache.poi.xwpf.usermodel.IBody#getParagraph(CTP p)
- */
+ @Override
public XWPFParagraph getParagraph(CTP p) {
for (XWPFParagraph paragraph : paragraphs) {
if (paragraph.getCTP().equals(p))
XWPFParagraph p = new XWPFParagraph(this.ctFtnEdn.addNewP(), this);
paragraphs.add(p);
bodyElements.add(p);
-
+
// If the paragraph is the first paragraph in the footnote,
// ensure that it has a footnote reference run.
-
+
if (p.equals(getParagraphs().get(0))) {
ensureFootnoteRef(p);
}
return table;
}
-}
\ No newline at end of file
+}
return styles;
}
- /**
- * get the paragraph with the CTP class p
- *
- * @param p
- * @return the paragraph with the CTP class p
- */
@Override
public XWPFParagraph getParagraph(CTP p) {
- for (int i = 0; i < getParagraphs().size(); i++) {
- if (getParagraphs().get(i).getCTP() == p) {
- return getParagraphs().get(i);
+ for (XWPFParagraph paragraph : paragraphs) {
+ if (paragraph.getCTP() == p) {
+ return paragraph;
}
}
return null;
return null;
}
- /**
- * if there is a corresponding {@link XWPFParagraph} of the parameter ctTable in the paragraphList of this header or footer
- * the method will return this paragraph
- * if there is no corresponding {@link XWPFParagraph} the method will return null
- *
- * @param p is instance of CTP and is searching for an XWPFParagraph
- * @return null if there is no XWPFParagraph with an corresponding CTPparagraph in the paragraphList of this header or footer
- * XWPFParagraph with the correspondig CTP p
- */
+ @Override
public XWPFParagraph getParagraph(CTP p) {
for (XWPFParagraph paragraph : paragraphs) {
if (paragraph.getCTP().equals(p))
return paragraph;
}
return null;
-
}
/**
bodyElements.remove(removedParagraph);
}
- /**
- * if there is a corresponding {@link XWPFParagraph} of the parameter ctTable in the paragraphList of this table
- * the method will return this paragraph
- * if there is no corresponding {@link XWPFParagraph} the method will return null
- *
- * @param p is instance of CTP and is searching for an XWPFParagraph
- * @return null if there is no XWPFParagraph with an corresponding CTPparagraph in the paragraphList of this table
- * XWPFParagraph with the correspondig CTP p
- */
+ @Override
public XWPFParagraph getParagraph(CTP p) {
for (XWPFParagraph paragraph : paragraphs) {
if (p.equals(paragraph.getCTP())) {