/** * The low level code to insert {@code <c:chart>} tag into * {@code<a:graphicData>}. * * Here is the schema (ECMA-376): * <pre> * {@code * <complexType name="CT_GraphicalObjectData"> * <sequence> * <any minOccurs="0" maxOccurs="unbounded" processContents="strict"/> * </sequence> * <attribute name="uri" type="xsd:token"/> * </complexType> * } * </pre> */ private void appendChartElement(CTGraphicalObjectData data, String id) { String r_namespaceUri = STRelationshipId.type.getName().getNamespaceURI(); String c_namespaceUri = XSSFDrawing.NAMESPACE_C; XmlCursor cursor = data.newCursor(); cursor.toNextToken(); cursor.beginElement(new QName(c_namespaceUri, "chart", "c")); cursor.insertAttributeWithValue(new QName(r_namespaceUri, "id", "r"), id); cursor.dispose(); data.setUri(c_namespaceUri); }
/*package*/ XSLFObjectShape(CTGraphicalObjectFrame shape, XSLFSheet sheet){ super(shape, sheet); CTGraphicalObjectData god = shape.getGraphic().getGraphicData(); XmlCursor xc = god.newCursor(); // select oleObj potentially under AlternateContent // usually the mc:Choice element will be selected first xc.selectPath("declare namespace p='"+PML_NS+"' .//p:oleObj"); try { if (!xc.toNextSelection()) { throw new IllegalStateException("p:oleObj element was not found in\n " + god); } XmlObject xo = xc.getObject(); // Pesky XmlBeans bug - see Bugzilla #49934 // it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas if (xo instanceof XmlAnyTypeImpl){ String errStr = "Schemas (*.xsb) for CTOleObject can't be loaded - usually this happens when OSGI " + "loading is used and the thread context classloader has no reference to " + "the xmlbeans classes - use POIXMLTypeLoader.setClassLoader() to set the loader, " + "e.g. with CTOleObject.class.getClassLoader()" ; throw new IllegalStateException(errStr); } _oleObject = (CTOleObject)xo; } finally { xc.dispose(); } }
/*package*/ XSLFTable(CTGraphicalObjectFrame shape, XSLFSheet sheet){ super(shape, sheet); CTGraphicalObjectData god = shape.getGraphic().getGraphicData(); XmlCursor xc = god.newCursor(); try { if (!xc.toChild(XSLFRelation.NS_DRAWINGML, "tbl")) { throw new IllegalStateException("a:tbl element was not found in\n " + god); } XmlObject xo = xc.getObject(); // Pesky XmlBeans bug - see Bugzilla #49934 // it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas if (xo instanceof XmlAnyTypeImpl){ String errStr = "Schemas (*.xsb) for CTTable can't be loaded - usually this happens when OSGI " + "loading is used and the thread context classloader has no reference to " + "the xmlbeans classes" ; throw new IllegalStateException(errStr); } _table = (CTTable)xo; } finally { xc.dispose(); } _rows = new ArrayList<>(_table.sizeOfTrArray()); for(CTTableRow row : _table.getTrList()) { _rows.add(new XSLFTableRow(row, this)); } updateRowColIndexes(); }
static CTGraphicalObjectFrame prototype(int shapeId){ CTGraphicalObjectFrame frame = CTGraphicalObjectFrame.Factory.newInstance(); CTGraphicalObjectFrameNonVisual nvGr = frame.addNewNvGraphicFramePr(); CTNonVisualDrawingProps cnv = nvGr.addNewCNvPr(); cnv.setName("Table " + shapeId); cnv.setId(shapeId); nvGr.addNewCNvGraphicFramePr().addNewGraphicFrameLocks().setNoGrp(true); nvGr.addNewNvPr(); frame.addNewXfrm(); CTGraphicalObjectData gr = frame.addNewGraphic().addNewGraphicData(); XmlCursor grCur = gr.newCursor(); grCur.toNextToken(); grCur.beginElement(new QName(XSLFRelation.NS_DRAWINGML, "tbl")); CTTable tbl = CTTable.Factory.newInstance(); tbl.addNewTblPr(); tbl.addNewTblGrid(); XmlCursor tblCur = tbl.newCursor(); tblCur.moveXmlContents(grCur); tblCur.dispose(); grCur.dispose(); gr.setUri(TABLE_URI); return frame; }
CTGraphicalObjectData gr = frame.addNewGraphic().addNewGraphicData(); gr.setUri(OLE_URI); XmlCursor grCur = gr.newCursor(); grCur.toEndToken(); grCur.beginElement(new QName(PML_NS, "oleObj"));
/** * The low level code to insert {@code <c:chart>} tag into * {@code<a:graphicData>}. * * Here is the schema (ECMA-376): * <pre> * {@code * <complexType name="CT_GraphicalObjectData"> * <sequence> * <any minOccurs="0" maxOccurs="unbounded" processContents="strict"/> * </sequence> * <attribute name="uri" type="xsd:token"/> * </complexType> * } * </pre> */ private void appendChartElement(CTGraphicalObjectData data, String id) { String r_namespaceUri = STRelationshipId.type.getName().getNamespaceURI(); String c_namespaceUri = XSSFDrawing.NAMESPACE_C; XmlCursor cursor = data.newCursor(); cursor.toNextToken(); cursor.beginElement(new QName(c_namespaceUri, "chart", "c")); cursor.insertAttributeWithValue(new QName(r_namespaceUri, "id", "r"), id); cursor.dispose(); data.setUri(c_namespaceUri); }
/** * The low level code to insert {@code <c:chart>} tag into * {@code<a:graphicData>}. * * Here is the schema (ECMA-376): * <pre> * {@code * <complexType name="CT_GraphicalObjectData"> * <sequence> * <any minOccurs="0" maxOccurs="unbounded" processContents="strict"/> * </sequence> * <attribute name="uri" type="xsd:token"/> * </complexType> * } * </pre> */ private void appendChartElement(CTGraphicalObjectData data, String id) { String r_namespaceUri = STRelationshipId.type.getName().getNamespaceURI(); String c_namespaceUri = XSSFDrawing.NAMESPACE_C; XmlCursor cursor = data.newCursor(); cursor.toNextToken(); cursor.beginElement(new QName(c_namespaceUri, "chart", "c")); cursor.insertAttributeWithValue(new QName(r_namespaceUri, "id", "r"), id); cursor.dispose(); data.setUri(c_namespaceUri); }
/*package*/ XSLFObjectShape(CTGraphicalObjectFrame shape, XSLFSheet sheet){ super(shape, sheet); CTGraphicalObjectData god = shape.getGraphic().getGraphicData(); XmlCursor xc = god.newCursor(); // select oleObj potentially under AlternateContent // usually the mc:Choice element will be selected first xc.selectPath("declare namespace p='"+PML_NS+"' .//p:oleObj"); try { if (!xc.toNextSelection()) { throw new IllegalStateException("p:oleObj element was not found in\n " + god); } XmlObject xo = xc.getObject(); // Pesky XmlBeans bug - see Bugzilla #49934 // it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas if (xo instanceof XmlAnyTypeImpl){ String errStr = "Schemas (*.xsb) for CTOleObject can't be loaded - usually this happens when OSGI " + "loading is used and the thread context classloader has no reference to " + "the xmlbeans classes - use POIXMLTypeLoader.setClassLoader() to set the loader, " + "e.g. with CTOleObject.class.getClassLoader()" ; throw new IllegalStateException(errStr); } _oleObject = (CTOleObject)xo; } finally { xc.dispose(); } }
/*package*/ XSLFTable(CTGraphicalObjectFrame shape, XSLFSheet sheet){ super(shape, sheet); CTGraphicalObjectData god = shape.getGraphic().getGraphicData(); XmlCursor xc = god.newCursor(); try { if (!xc.toChild(XSLFRelation.NS_DRAWINGML, "tbl")) { throw new IllegalStateException("a:tbl element was not found in\n " + god); } XmlObject xo = xc.getObject(); // Pesky XmlBeans bug - see Bugzilla #49934 // it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas if (xo instanceof XmlAnyTypeImpl){ String errStr = "Schemas (*.xsb) for CTTable can't be loaded - usually this happens when OSGI " + "loading is used and the thread context classloader has no reference to " + "the xmlbeans classes" ; throw new IllegalStateException(errStr); } _table = (CTTable)xo; } finally { xc.dispose(); } _rows = new ArrayList<>(_table.sizeOfTrArray()); for(CTTableRow row : _table.getTrList()) { _rows.add(new XSLFTableRow(row, this)); } updateRowColIndexes(); }
static CTGraphicalObjectFrame prototype(int shapeId){ CTGraphicalObjectFrame frame = CTGraphicalObjectFrame.Factory.newInstance(); CTGraphicalObjectFrameNonVisual nvGr = frame.addNewNvGraphicFramePr(); CTNonVisualDrawingProps cnv = nvGr.addNewCNvPr(); cnv.setName("Table " + shapeId); cnv.setId(shapeId + 1); nvGr.addNewCNvGraphicFramePr().addNewGraphicFrameLocks().setNoGrp(true); nvGr.addNewNvPr(); frame.addNewXfrm(); CTGraphicalObjectData gr = frame.addNewGraphic().addNewGraphicData(); XmlCursor cursor = gr.newCursor(); cursor.toNextToken(); cursor.beginElement(new QName("http://schemas.openxmlformats.org/drawingml/2006/main", "tbl")); cursor.beginElement(new QName("http://schemas.openxmlformats.org/drawingml/2006/main", "tblPr")); cursor.toNextToken(); cursor.beginElement(new QName("http://schemas.openxmlformats.org/drawingml/2006/main", "tblGrid")); cursor.dispose(); gr.setUri(TABLE_URI); return frame; }
if ( graphicData != null ) XmlCursor c = graphicData.newCursor(); c.selectPath( "./*" ); while ( c.toNextSelection() )
if ( graphicData != null ) XmlCursor c = graphicData.newCursor(); c.selectPath( "./*" ); while ( c.toNextSelection() )
XmlCursor c = data.newCursor(); c.selectPath("declare namespace pic='"+CTTable.type.getName().getNamespaceURI()+"' .//pic:tbl");
if ( graphicData != null ) XmlCursor c = graphicData.newCursor(); c.selectPath( "./*" ); while ( c.toNextSelection() )
if ( graphicData != null ) XmlCursor c = graphicData.newCursor(); c.selectPath( "./*" ); while ( c.toNextSelection() )
if ( graphicData != null ) XmlCursor c = graphicData.newCursor(); c.selectPath( "./*" ); while ( c.toNextSelection() )
static CTGraphicalObjectFrame prototype(int shapeId){ CTGraphicalObjectFrame frame = CTGraphicalObjectFrame.Factory.newInstance(); CTGraphicalObjectFrameNonVisual nvGr = frame.addNewNvGraphicFramePr(); CTNonVisualDrawingProps cnv = nvGr.addNewCNvPr(); cnv.setName("Table " + shapeId); cnv.setId(shapeId); nvGr.addNewCNvGraphicFramePr().addNewGraphicFrameLocks().setNoGrp(true); nvGr.addNewNvPr(); frame.addNewXfrm(); CTGraphicalObjectData gr = frame.addNewGraphic().addNewGraphicData(); XmlCursor grCur = gr.newCursor(); grCur.toNextToken(); grCur.beginElement(new QName(XSLFRelation.NS_DRAWINGML, "tbl")); CTTable tbl = CTTable.Factory.newInstance(); tbl.addNewTblPr(); tbl.addNewTblGrid(); XmlCursor tblCur = tbl.newCursor(); tblCur.moveXmlContents(grCur); tblCur.dispose(); grCur.dispose(); gr.setUri(TABLE_URI); return frame; }
CTGraphicalObjectData gr = frame.addNewGraphic().addNewGraphicData(); gr.setUri(OLE_URI); XmlCursor grCur = gr.newCursor(); grCur.toEndToken(); grCur.beginElement(new QName(PML_NS, "oleObj"));