コード例 #1
0
 /**
  * inserts an existing XWPFTable to the arrays bodyElements and tables
  *
  * @param pos
  * @param table
  */
 public void insertTable(int pos, XWPFTable table) {
   bodyElements.add(pos, table);
   int i;
   for (i = 0; i < headerFooter.getTblList().size(); i++) {
     CTTbl tbl = headerFooter.getTblArray(i);
     if (tbl == table.getCTTbl()) {
       break;
     }
   }
   tables.add(i, table);
 }
コード例 #2
0
 public void readHdrFtr() {
   bodyElements = new ArrayList<IBodyElement>();
   paragraphs = new ArrayList<XWPFParagraph>();
   tables = new ArrayList<XWPFTable>();
   // parse the document with cursor and add
   // the XmlObject to its lists
   XmlCursor cursor = headerFooter.newCursor();
   cursor.selectPath("./*");
   while (cursor.toNextSelection()) {
     XmlObject o = cursor.getObject();
     if (o instanceof CTP) {
       XWPFParagraph p = new XWPFParagraph((CTP) o, this);
       paragraphs.add(p);
       bodyElements.add(p);
     }
     if (o instanceof CTTbl) {
       XWPFTable t = new XWPFTable((CTTbl) o, this);
       tables.add(t);
       bodyElements.add(t);
     }
   }
   cursor.dispose();
   getAllPictures();
 }