/** * Adds a new table at the end of the header or footer * * @param rows - number of rows in the table * @param cols - number of columns in the table * @return new {@link XWPFTable} object */ public XWPFTable createTable(int rows, int cols) { XWPFTable table = new XWPFTable(headerFooter.addNewTbl(), this, rows, cols); tables.add(table); bodyElements.add(table); return table; }
/** * Appends a new {@link XWPFTable} to this footnote * @param rows Number of rows to initialize the table with * @param cols Number of columns to initialize the table with * @return the new {@link XWPFTable} with the specified number of rows and columns * @since 4.0.0 */ public XWPFTable createTable(int rows, int cols) { XWPFTable table = new XWPFTable(ctFtnEdn.addNewTbl(), this, rows, cols); bodyElements.add(table); tables.add(table); return table; }
/** * Create an empty table with one row and one column as default. * * @return a new table */ public XWPFTable createTable() { XWPFTable table = new XWPFTable(ctDocument.getBody().addNewTbl(), this); bodyElements.add(table); tables.add(table); return table; }
/** * Create an empty table with a number of rows and cols specified * * @param rows * @param cols * @return table */ public XWPFTable createTable(int rows, int cols) { XWPFTable table = new XWPFTable(ctDocument.getBody().addNewTbl(), this, rows, cols); bodyElements.add(table); tables.add(table); return table; }
/** * Add a new {@link XWPFTable} to the end of the footnote. * * @param table CTTbl object from which to construct the {@link XWPFTable} * @return The added {@link XWPFTable} */ public XWPFTable addNewTbl(CTTbl table) { CTTbl newTable = ctFtnEdn.addNewTbl(); newTable.set(table); XWPFTable xTable = new XWPFTable(newTable, this); tables.add(xTable); return xTable; }
/** * Appends a new {@link XWPFTable} to this footnote * * @return The new {@link XWPFTable} * @since 4.0.0 */ public XWPFTable createTable() { XWPFTable table = new XWPFTable(ctFtnEdn.addNewTbl(), this); if (bodyElements.size() == 0) { XWPFParagraph p = createParagraph(); ensureFootnoteRef(p); } bodyElements.add(table); tables.add(table); return table; }
public void readHdrFtr() { bodyElements = new ArrayList<>(); paragraphs = new ArrayList<>(); tables = new ArrayList<>(); // 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(); }
public XWPFFooter(XWPFDocument doc, CTHdrFtr hdrFtr) throws IOException { super(doc, hdrFtr); 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(); }
protected void init() { XmlCursor cursor = ctFtnEdn.newCursor(); //copied from XWPFDocument...should centralize this code //to avoid duplication cursor.selectPath("./*"); while (cursor.toNextSelection()) { XmlObject o = cursor.getObject(); if (o instanceof CTP) { XWPFParagraph p = new XWPFParagraph((CTP) o, this); bodyElements.add(p); paragraphs.add(p); } else if (o instanceof CTTbl) { XWPFTable t = new XWPFTable((CTTbl) o, this); bodyElements.add(t); tables.add(t); } else if (o instanceof CTSdtBlock) { XWPFSDT c = new XWPFSDT((CTSdtBlock) o, this); bodyElements.add(c); } } cursor.dispose(); }
public XWPFHeader(XWPFDocument doc, CTHdrFtr hdrFtr) { super(doc, hdrFtr); 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); } if (o instanceof CTTbl) { XWPFTable t = new XWPFTable((CTTbl) o, this); tables.add(t); } } cursor.dispose(); }
public XWPFSDTContent(CTSdtContentBlock block, IBody part, IRunBody parent) { if (block == null) { return; } XmlCursor cursor = block.newCursor(); cursor.selectPath("./*"); while (cursor.toNextSelection()) { XmlObject o = cursor.getObject(); if (o instanceof CTP) { XWPFParagraph p = new XWPFParagraph((CTP) o, part); bodyElements.add(p); // paragraphs.add(p); } else if (o instanceof CTTbl) { XWPFTable t = new XWPFTable((CTTbl) o, part); bodyElements.add(t); // tables.add(t); } else if (o instanceof CTSdtBlock) { XWPFSDT c = new XWPFSDT(((CTSdtBlock) o), part); bodyElements.add(c); // contentControls.add(c); } else if (o instanceof CTR) { XWPFRun run = new XWPFRun((CTR) o, parent); // runs.add(run); bodyElements.add(run); } } cursor.dispose(); }
XWPFTable t = new XWPFTable((CTTbl) o, this); tables.add(t); bodyElements.add(t);
XWPFTable t = new XWPFTable((CTTbl) o, this); tables.add(t); bodyElements.add(t);
XWPFTable t = new XWPFTable((CTTbl) o, this); tables.add(t); bodyElements.add(t);
cursor.toParent(); CTTbl t = (CTTbl) cursor.getObject(); XWPFTable newT = new XWPFTable(t, this); XmlObject o = null; while (!(o instanceof CTTbl) && (cursor.toPrevSibling())) {
cursor.toParent(); CTTbl t = (CTTbl) cursor.getObject(); XWPFTable newT = new XWPFTable(t, this); cursor.removeXmlContents(); XmlObject o = null;
cursor.toParent(); CTTbl t = (CTTbl) cursor.getObject(); XWPFTable newT = new XWPFTable(t, this); cursor.removeXmlContents(); XmlObject o = null;
cursor.toParent(); CTTbl t = (CTTbl) cursor.getObject(); XWPFTable newT = new XWPFTable(t, this); cursor.removeXmlContents(); XmlObject o = null;
paragraphs.add(p); } else if (bodyObj instanceof CTTbl) { XWPFTable t = new XWPFTable((CTTbl) bodyObj, this); bodyElements.add(t); tables.add(t);
XWPFTable newT = new XWPFTable(t, this, row, col); XmlObject o = null; while (!(o instanceof CTTbl) && (cursor.toPrevSibling())) {