From: Nick Burch Date: Sat, 9 Aug 2008 12:15:32 +0000 (+0000) Subject: Improve how XWPFParagraph works, so it is child order aware X-Git-Tag: REL_3_5_BETA2~17 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ef8ded706d6fc5ce6b220bdf61c981d3933795b3;p=poi.git Improve how XWPFParagraph works, so it is child order aware git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@684239 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ooxml/java/org/apache/poi/xwpf/XWPFDocument.java b/src/ooxml/java/org/apache/poi/xwpf/XWPFDocument.java index d53cfa5763..6b25a42b9e 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/XWPFDocument.java +++ b/src/ooxml/java/org/apache/poi/xwpf/XWPFDocument.java @@ -159,10 +159,14 @@ public class XWPFDocument extends POIXMLDocument { return wordDoc.getDocument(); } - public Iterator getParagraphsIterator() - { + public Iterator getParagraphsIterator() { return paragraphs.iterator(); } + public XWPFParagraph[] getParagraphs() { + return paragraphs.toArray( + new XWPFParagraph[paragraphs.size()] + ); + } public Iterator getTablesIterator() { diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java index 4b1325f183..7150014e27 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java @@ -30,4 +30,39 @@ public abstract class XWPFHeaderFooter { protected XWPFHeaderFooter() { headerFooter = CTHdrFtr.Factory.newInstance(); } + + public CTHdrFtr _getHdrFtr() { + return headerFooter; + } + + /** + * Returns the paragraph(s) that holds + * the text of the header or footer. + * Normally there is only the one paragraph, but + * there could be more in certain cases. + */ + public XWPFParagraph[] getParagraphs() { + XWPFParagraph[] paras = + new XWPFParagraph[headerFooter.getPArray().length]; + for(int i=0; i