/** * Verifies that cursor is on the right position. * * @param cursor * @return true if the cursor is within a CTFtnEdn element. */ private boolean isCursorInFtn(XmlCursor cursor) { XmlCursor verify = cursor.newCursor(); verify.toParent(); if (verify.getObject() == this.ctFtnEdn) { return true; } return false; }
/** * verifies that cursor is on the right position */ private boolean isCursorInTableCell(XmlCursor cursor) { XmlCursor verify = cursor.newCursor(); verify.toParent(); boolean result = (verify.getObject() == this.ctTc); verify.dispose(); return result; }
/** * verifies that cursor is on the right position * * @param cursor */ private boolean isCursorInHdrF(XmlCursor cursor) { XmlCursor verify = cursor.newCursor(); verify.toParent(); boolean result = (verify.getObject() == this.headerFooter); verify.dispose(); return result; }
/** * verifies that cursor is on the right position * * @param cursor */ private boolean isCursorInBody(XmlCursor cursor) { XmlCursor verify = cursor.newCursor(); verify.toParent(); boolean result = (verify.getObject() == this.ctDocument.getBody()); verify.dispose(); return result; }
/** * get the TableCell which belongs to the TableCell */ public XWPFTableCell getTableCell(CTTc cell) { XmlCursor cursor = cell.newCursor(); cursor.toParent(); XmlObject o = cursor.getObject(); if (!(o instanceof CTRow)) { return null; } CTRow row = (CTRow) o; cursor.toParent(); o = cursor.getObject(); cursor.dispose(); if (!(o instanceof CTTbl)) { return null; } CTTbl tbl = (CTTbl) o; XWPFTable table = getTable(tbl); if (table == null) { return null; } XWPFTableRow tr = table.getRow(row); if (tr == null) { return null; } return tr.getTableCell(cell); }
/** * get the TableCell which belongs to the TableCell * * @param cell */ public XWPFTableCell getTableCell(CTTc cell) { XmlCursor cursor = cell.newCursor(); cursor.toParent(); XmlObject o = cursor.getObject(); if (!(o instanceof CTRow)) { cursor.dispose(); return null; } CTRow row = (CTRow) o; cursor.toParent(); o = cursor.getObject(); cursor.dispose(); if (!(o instanceof CTTbl)) { return null; } CTTbl tbl = (CTTbl) o; XWPFTable table = getTable(tbl); if (table == null) { return null; } XWPFTableRow tableRow = table.getRow(row); return tableRow.getTableCell(cell); }
String localPart = "tbl"; cursor.beginElement(localPart, uri); cursor.toParent(); CTTbl t = (CTTbl) cursor.getObject(); XWPFTable newT = new XWPFTable(t, this);
String localPart = "tbl"; cursor.beginElement(localPart, uri); cursor.toParent(); CTTbl t = (CTTbl) cursor.getObject(); XWPFTable newT = new XWPFTable(t, this);
String localPart = "tbl"; cursor.beginElement(localPart, uri); cursor.toParent(); CTTbl t = (CTTbl) cursor.getObject(); XWPFTable newT = new XWPFTable(t, this);
String localPart = "p"; cursor.beginElement(localPart, uri); cursor.toParent(); CTP p = (CTP) cursor.getObject(); XWPFParagraph newP = new XWPFParagraph(p, this);
String localPart = "tbl"; cursor.beginElement(localPart, uri); cursor.toParent(); CTTbl t = (CTTbl) cursor.getObject(); XWPFTable newT = new XWPFTable(t, this);
String localPart = "p"; cursor.beginElement(localPart, uri); cursor.toParent(); CTP p = (CTP) cursor.getObject(); XWPFParagraph newP = new XWPFParagraph(p, this);
String localPart = "p"; cursor.beginElement(localPart, uri); cursor.toParent(); CTP p = (CTP) cursor.getObject(); XWPFParagraph newP = new XWPFParagraph(p, this);
cursor.toParent(); CTP p = (CTP) cursor.getObject(); XWPFParagraph newP = new XWPFParagraph(p, this);
private XSSFAnchor getAnchorFromParent(XmlObject obj) { XSSFAnchor anchor = null; XmlObject parentXbean = null; XmlCursor cursor = obj.newCursor(); if (cursor.toParent()) { parentXbean = cursor.getObject(); } cursor.dispose(); if (parentXbean != null) { if (parentXbean instanceof CTTwoCellAnchor) { CTTwoCellAnchor ct = (CTTwoCellAnchor) parentXbean; anchor = new XSSFClientAnchor(ct.getFrom(), ct.getTo()); } else if (parentXbean instanceof CTOneCellAnchor) { CTOneCellAnchor ct = (CTOneCellAnchor) parentXbean; anchor = new XSSFClientAnchor(getSheet(), ct.getFrom(), ct.getExt()); } else if (parentXbean instanceof CTAbsoluteAnchor) { CTAbsoluteAnchor ct = (CTAbsoluteAnchor) parentXbean; anchor = new XSSFClientAnchor(getSheet(), ct.getPos(), ct.getExt()); } } return anchor; }
/** * True if the object is at the root of the document. */ private boolean isRootXmlObject() { XmlCursor cur = newCursor(); if (cur == null) return false; boolean result = !cur.toParent(); cur.dispose(); return result; }
cur2.dispose(); cur1.toParent(); cur1.toFirstChild(); cur1.setName(new QName(XSSFRelation.NS_SPREADSHEETML, "from"));
static FormChoice findElementFormDefault(XmlObject obj) { XmlCursor cur = obj.newCursor(); while (cur.getObject().schemaType() != Schema.type) if (!cur.toParent()) return null; return ((Schema)cur.getObject()).xgetElementFormDefault(); }