<changes>
<release version="3.7-beta3" date="2010-??-??">
+ <action dev="poi-developers" type="add">Add a getBodyElements() method to XWPF IBody, to make access to embedded paragraphs and tables easier</action>
<action dev="poi-developers" type="add">More XSLFRelation entries for common .pptx file parts</action>
<action dev="poi-developers" type="fix">49872 - avoid exception in XSSFFormulaEvaluator.evaluateInCell when evaluating shared formulas</action>
<action dev="poi-developers" type="fix">49895 - avoid corruption of XSSFWorkbook after removing all merged cells from sheet</action>
* @return
*/
BodyType getPartType();
+
+ /**
+ * Returns an Iterator with paragraphs and tables,
+ * in the order that they occur in the text.
+ */
+ public List<IBodyElement> getBodyElements();
+
/**
* Returns the paragraph(s) that holds
* the text of the header or footer.
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTableRow;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTComment;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocument1;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn;
return headerFooter;
}
+ public List<IBodyElement> getBodyElements(){
+ return Collections.unmodifiableList(bodyElements);
+ }
+
/**
* Returns the paragraph(s) that holds
* the text of the header or footer.
return null;
}
+ public String getName() {
+ if(ctStyle.isSetName())
+ return ctStyle.getName().getVal();
+ return null;
+ }
+
/**
* compares the names of the Styles
* @param compStyle
protected List<XWPFTableRow> tableRows;
protected List<String> styleIDs;
protected IBody part;
- private XWPFDocument document;
public XWPFTable(CTTbl table, IBody part, int row, int col) {
this(table, part);
return ctTc;
}
+ /**
+ * returns an Iterator with paragraphs and tables
+ * @see org.apache.poi.xwpf.usermodel.IBody#getBodyElements()
+ * @return
+ */
+ public List<IBodyElement> getBodyElements(){
+ return Collections.unmodifiableList(bodyElements);
+ }
+
public void setParagraph(XWPFParagraph p) {
if (ctTc.sizeOfPArray() == 0) {
ctTc.addNewP();
assertEquals(0, paragraph.getCTP().sizeOfBookmarkEndArray());
CTBookmark ctBookmark = paragraph.getCTP().getBookmarkStartArray(0);
assertEquals("poi", ctBookmark.getName());
+ for(CTBookmark bookmark : paragraph.getCTP().getBookmarkStartList()) {
+ assertEquals("poi", bookmark.getName());
+ }
}
public void testGetSetNumID() {