コード例 #1
0
ファイル: StyleDefaults.cs プロジェクト: xewn/Npoi.Core
        public static CT_DefaultShapeDefinition Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_DefaultShapeDefinition ctObj = new CT_DefaultShapeDefinition();

            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "spPr")
                {
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "bodyPr")
                {
                    ctObj.bodyPr = CT_TextBodyProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "lstStyle")
                {
                    ctObj.lstStyle = CT_TextListStyle.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "style")
                {
                    ctObj.style = CT_ShapeStyle.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
コード例 #2
0
ファイル: SpreadsheetPicture.cs プロジェクト: hiodava/Romero
        public static CT_Picture Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Picture ctObj = new CT_Picture();

            ctObj.macro      = XmlHelper.ReadString(node.Attributes["macro"]);
            ctObj.fPublished = XmlHelper.ReadBool(node.Attributes["fPublished"]);
            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "nvPicPr")
                {
                    ctObj.nvPicPr = CT_PictureNonVisual.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "blipFill")
                {
                    ctObj.blipFill = CT_BlipFillProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "spPr")
                {
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "style")
                {
                    ctObj.style = CT_ShapeStyle.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
コード例 #3
0
ファイル: spreadsheetShape.cs プロジェクト: evlon/npoi
        public static CT_Shape Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Shape ctObj = new CT_Shape();

            ctObj.macro      = XmlHelper.ReadString(node.Attributes["macro"]);
            ctObj.textlink   = XmlHelper.ReadString(node.Attributes["textlink"]);
            ctObj.fLocksText = XmlHelper.ReadBool(node.Attributes["fLocksText"]);
            ctObj.fPublished = XmlHelper.ReadBool(node.Attributes["fPublished"]);
            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "nvSpPr")
                {
                    ctObj.nvSpPr = CT_ShapeNonVisual.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "spPr")
                {
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "txBody")
                {
                    ctObj.txBody = CT_TextBody.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "style")
                {
                    ctObj.style = CT_ShapeStyle.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
コード例 #4
0
ファイル: XSSFPicture.cs プロジェクト: thachgiasoft/shuijin
 internal static CT_Picture Prototype()
 {
     if (XSSFPicture.prototype == null)
     {
         CT_Picture               ctPicture          = new CT_Picture();
         CT_PictureNonVisual      pictureNonVisual   = ctPicture.AddNewNvPicPr();
         CT_NonVisualDrawingProps visualDrawingProps = pictureNonVisual.AddNewCNvPr();
         visualDrawingProps.id    = 1U;
         visualDrawingProps.name  = "Picture 1";
         visualDrawingProps.descr = "Picture";
         pictureNonVisual.AddNewCNvPicPr().AddNewPicLocks().noChangeAspect = true;
         CT_BlipFillProperties blipFillProperties = ctPicture.AddNewBlipFill();
         blipFillProperties.AddNewBlip().embed    = "";
         blipFillProperties.AddNewStretch().AddNewFillRect();
         CT_ShapeProperties ctShapeProperties = ctPicture.AddNewSpPr();
         CT_Transform2D     ctTransform2D     = ctShapeProperties.AddNewXfrm();
         CT_PositiveSize2D  ctPositiveSize2D  = ctTransform2D.AddNewExt();
         ctPositiveSize2D.cx = 0L;
         ctPositiveSize2D.cy = 0L;
         CT_Point2D ctPoint2D = ctTransform2D.AddNewOff();
         ctPoint2D.x = 0L;
         ctPoint2D.y = 0L;
         CT_PresetGeometry2D presetGeometry2D = ctShapeProperties.AddNewPrstGeom();
         presetGeometry2D.prst = ST_ShapeType.rect;
         presetGeometry2D.AddNewAvLst();
         XSSFPicture.prototype = ctPicture;
     }
     return(XSSFPicture.prototype);
 }
コード例 #5
0
        public static CT_Surface Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Surface ctObj = new CT_Surface();

            ctObj.extLst = new List <CT_Extension>();
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "thickness")
                {
                    ctObj.thickness = CT_UnsignedInt.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "spPr")
                {
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "pictureOptions")
                {
                    ctObj.pictureOptions = CT_PictureOptions.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst.Add(CT_Extension.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
コード例 #6
0
ファイル: XSSFShape.cs プロジェクト: purehzj/npoi-1
 /**
  * Sets the color used to fill this shape using the solid fill pattern.
  */
 public void SetFillColor(int red, int green, int blue)
 {
     CT_ShapeProperties props = GetShapeProperties();
     CT_SolidColorFillProperties fill = props.IsSetSolidFill() ? props.solidFill : props.AddNewSolidFill();
     CT_SRgbColor rgb = new CT_SRgbColor();
     rgb.val = (new byte[] { (byte)red, (byte)green, (byte)blue });
     fill.srgbClr = (rgb);
 }
コード例 #7
0
 public CT_Shape()
 {
     this.txBodyField     = new CT_TextBody();
     this.styleField      = new CT_ShapeStyle();
     this.spPrField       = new CT_ShapeProperties();
     this.nvSpPrField     = new CT_ShapeNonVisual();
     this.fLocksTextField = true;
     this.fPublishedField = false;
 }
コード例 #8
0
 public void Set(CT_Connector obj)
 {
     //throw new NotImplementedException();
     this.macroField     = obj.macro;
     this.fPublishField  = obj.fPublished;
     this.spPrField      = obj.spPr;
     this.styleField     = obj.style;
     this.nvCxnSpPrField = obj.nvCxnSpPr;
 }
コード例 #9
0
ファイル: DiagramDataModel.cs プロジェクト: xewn/Npoi.Core
 public CT_Pt()
 {
     this.extLstField = new CT_OfficeArtExtensionList();
     this.tField      = new CT_TextBody();
     this.spPrField   = new CT_ShapeProperties();
     this.prSetField  = new CT_ElemPropSet();
     this.typeField   = ST_PtType.node;
     this.cxnIdField  = "0";
 }
コード例 #10
0
ファイル: XSSFShape.cs プロジェクト: purehzj/npoi-1
 /**
  * The color applied to the lines of this shape.
  */
 public void SetLineStyleColor(int red, int green, int blue)
 {
     CT_ShapeProperties props = GetShapeProperties();
     CT_LineProperties ln = props.IsSetLn() ? props.ln : props.AddNewLn();
     CT_SolidColorFillProperties fill = ln.IsSetSolidFill() ? ln.solidFill : ln.AddNewSolidFill();
     CT_SRgbColor rgb = new CT_SRgbColor();
     rgb.val = (new byte[] { (byte)red, (byte)green, (byte)blue });
     fill.srgbClr = (rgb);
 }
コード例 #11
0
ファイル: RadarChart.cs プロジェクト: ruo2012/Npoi.Core
        public static CT_RadarSer Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_RadarSer ctObj = new CT_RadarSer();

            ctObj.dPt    = new List <CT_DPt>();
            ctObj.extLst = new List <CT_Extension>();
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "idx")
                {
                    ctObj.idx = CT_UnsignedInt.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "order")
                {
                    ctObj.order = CT_UnsignedInt.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "tx")
                {
                    ctObj.tx = CT_SerTx.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "spPr")
                {
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "marker")
                {
                    ctObj.marker = CT_Marker.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "dLbls")
                {
                    ctObj.dLbls = CT_DLbls.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "cat")
                {
                    ctObj.cat = CT_AxDataSource.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "val")
                {
                    ctObj.val = CT_NumDataSource.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "dPt")
                {
                    ctObj.dPt.Add(CT_DPt.Parse(childNode, namespaceManager));
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst.Add(CT_Extension.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
コード例 #12
0
        public XWPFPicture AddPicture(Stream pictureData, int pictureType, string filename, int width, int height)
        {
            XWPFDocument    document     = this.paragraph.GetDocument();
            string          id           = document.AddPictureData(pictureData, pictureType);
            XWPFPictureData relationById = (XWPFPictureData)document.GetRelationById(id);

            try
            {
                CT_Inline  ctInline = this.run.AddNewDrawing().AddNewInline();
                XmlElement element  = new XmlDocument().CreateElement("pic", "pic", "http://schemas.openxmlformats.org/drawingml/2006/picture");
                ctInline.graphic             = new CT_GraphicalObject();
                ctInline.graphic.graphicData = new CT_GraphicalObjectData();
                ctInline.graphic.graphicData.AddPicElement((XmlElement)element.Clone());
                ctInline.distT = 0U;
                ctInline.distR = 0U;
                ctInline.distB = 0U;
                ctInline.distL = 0U;
                CT_NonVisualDrawingProps visualDrawingProps1 = ctInline.AddNewDocPr();
                long num = this.GetParagraph().GetDocument().GetDrawingIdManager().ReserveNew();
                visualDrawingProps1.id    = (uint)num;
                visualDrawingProps1.name  = "Drawing " + (object)num;
                visualDrawingProps1.descr = filename;
                CT_PositiveSize2D ctPositiveSize2D1 = ctInline.AddNewExtent();
                ctPositiveSize2D1.cx = (long)width;
                ctPositiveSize2D1.cy = (long)height;
                NPOI.OpenXmlFormats.Dml.Picture.CT_Picture ctPicture = this.GetCTPictures((object)ctInline.graphic.graphicData)[0];
                CT_PictureNonVisual      pictureNonVisual            = ctPicture.AddNewNvPicPr();
                CT_NonVisualDrawingProps visualDrawingProps2         = pictureNonVisual.AddNewCNvPr();
                visualDrawingProps2.id    = 0U;
                visualDrawingProps2.name  = "Picture " + (object)num;
                visualDrawingProps2.descr = filename;
                pictureNonVisual.AddNewCNvPicPr().AddNewPicLocks().noChangeAspect = true;
                CT_BlipFillProperties blipFillProperties = ctPicture.AddNewBlipFill();
                blipFillProperties.AddNewBlip().embed    = relationById.GetPackageRelationship().Id;
                blipFillProperties.AddNewStretch().AddNewFillRect();
                CT_ShapeProperties ctShapeProperties = ctPicture.AddNewSpPr();
                CT_Transform2D     ctTransform2D     = ctShapeProperties.AddNewXfrm();
                CT_Point2D         ctPoint2D         = ctTransform2D.AddNewOff();
                ctPoint2D.x = 0L;
                ctPoint2D.y = 0L;
                CT_PositiveSize2D ctPositiveSize2D2 = ctTransform2D.AddNewExt();
                ctPositiveSize2D2.cx = (long)width;
                ctPositiveSize2D2.cy = (long)height;
                CT_PresetGeometry2D presetGeometry2D = ctShapeProperties.AddNewPrstGeom();
                presetGeometry2D.prst = ST_ShapeType.rect;
                presetGeometry2D.AddNewAvLst();
                XWPFPicture xwpfPicture = new XWPFPicture(ctPicture, this);
                this.pictures.Add(xwpfPicture);
                return(xwpfPicture);
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("", ex);
            }
        }
コード例 #13
0
ファイル: spreadsheetShape.cs プロジェクト: evlon/npoi
        public void Set(CT_Shape obj)
        {
            this.macroField      = obj.macro;
            this.textlinkField   = obj.textlink;
            this.fLocksTextField = obj.fLocksText;
            this.fPublishedField = obj.fPublished;

            this.nvSpPrField = obj.nvSpPr;
            this.spPrField   = obj.spPr;
            this.styleField  = obj.style;
            this.txBodyField = obj.txBody;
        }
コード例 #14
0
        public void SetFillColor(int red, int green, int blue)
        {
            CT_ShapeProperties shapeProperties = this.GetShapeProperties();

            (shapeProperties.IsSetSolidFill() ? shapeProperties.solidFill : shapeProperties.AddNewSolidFill()).srgbClr = new CT_SRgbColor()
            {
                val = new byte[3]
                {
                    (byte)red,
                    (byte)green,
                    (byte)blue
                }
            };
        }
コード例 #15
0
 internal static CT_Shape Prototype()
 {
     if (XSSFSimpleShape.prototype == null)
     {
         CT_Shape                 ctShape            = new CT_Shape();
         CT_ShapeNonVisual        ctShapeNonVisual   = ctShape.AddNewNvSpPr();
         CT_NonVisualDrawingProps visualDrawingProps = ctShapeNonVisual.AddNewCNvPr();
         visualDrawingProps.id   = 1U;
         visualDrawingProps.name = "Shape 1";
         ctShapeNonVisual.AddNewCNvSpPr();
         CT_ShapeProperties ctShapeProperties = ctShape.AddNewSpPr();
         CT_Transform2D     ctTransform2D     = ctShapeProperties.AddNewXfrm();
         CT_PositiveSize2D  ctPositiveSize2D  = ctTransform2D.AddNewExt();
         ctPositiveSize2D.cx = 0L;
         ctPositiveSize2D.cy = 0L;
         CT_Point2D ctPoint2D = ctTransform2D.AddNewOff();
         ctPoint2D.x = 0L;
         ctPoint2D.y = 0L;
         CT_PresetGeometry2D presetGeometry2D = ctShapeProperties.AddNewPrstGeom();
         presetGeometry2D.prst = ST_ShapeType.rect;
         presetGeometry2D.AddNewAvLst();
         CT_ShapeStyle  ctShapeStyle  = ctShape.AddNewStyle();
         CT_SchemeColor ctSchemeColor = ctShapeStyle.AddNewLnRef().AddNewSchemeClr();
         ctSchemeColor.val = ST_SchemeColorVal.accent1;
         ctSchemeColor.AddNewShade().val = 50000;
         ctShapeStyle.lnRef.idx = 2U;
         CT_StyleMatrixReference styleMatrixReference1 = ctShapeStyle.AddNewFillRef();
         styleMatrixReference1.idx = 1U;
         styleMatrixReference1.AddNewSchemeClr().val   = ST_SchemeColorVal.accent1;
         CT_StyleMatrixReference styleMatrixReference2 = ctShapeStyle.AddNewEffectRef();
         styleMatrixReference2.idx = 0U;
         styleMatrixReference2.AddNewSchemeClr().val = ST_SchemeColorVal.accent1;
         CT_FontReference ctFontReference            = ctShapeStyle.AddNewFontRef();
         ctFontReference.idx = ST_FontCollectionIndex.minor;
         ctFontReference.AddNewSchemeClr().val    = ST_SchemeColorVal.lt1;
         CT_TextBody           ctTextBody         = ctShape.AddNewTxBody();
         CT_TextBodyProperties textBodyProperties = ctTextBody.AddNewBodyPr();
         textBodyProperties.anchor = ST_TextAnchoringType.ctr;
         textBodyProperties.rtlCol = false;
         CT_TextParagraph ctTextParagraph = ctTextBody.AddNewP();
         ctTextParagraph.AddNewPPr().algn = ST_TextAlignType.ctr;
         CT_TextCharacterProperties characterProperties = ctTextParagraph.AddNewEndParaRPr();
         characterProperties.lang = "en-US";
         characterProperties.sz   = 1100;
         ctTextBody.AddNewLstStyle();
         XSSFSimpleShape.prototype = ctShape;
     }
     return(XSSFSimpleShape.prototype);
 }
コード例 #16
0
        public void SetLineStyleColor(int red, int green, int blue)
        {
            CT_ShapeProperties shapeProperties  = this.GetShapeProperties();
            CT_LineProperties  ctLineProperties = shapeProperties.IsSetLn() ? shapeProperties.ln : shapeProperties.AddNewLn();

            (ctLineProperties.IsSetSolidFill() ? ctLineProperties.solidFill : ctLineProperties.AddNewSolidFill()).srgbClr = new CT_SRgbColor()
            {
                val = new byte[3]
                {
                    (byte)red,
                    (byte)green,
                    (byte)blue
                }
            };
        }
コード例 #17
0
        public static CT_UpDownBar Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_UpDownBar ctObj = new CT_UpDownBar();

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "spPr")
                {
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
コード例 #18
0
        /**
         * Initialize default structure of a new auto-shape
         *
         */
        public static CT_Connector Prototype()
        {
            if (prototype == null)
            {
                CT_Connector             shape = new CT_Connector();
                CT_ConnectorNonVisual    nv    = shape.AddNewNvCxnSpPr();
                CT_NonVisualDrawingProps nvp   = nv.AddNewCNvPr();
                nvp.id   = (1);
                nvp.name = ("Shape 1");
                nv.AddNewCNvCxnSpPr();

                CT_ShapeProperties sp  = shape.AddNewSpPr();
                CT_Transform2D     t2d = sp.AddNewXfrm();
                CT_PositiveSize2D  p1  = t2d.AddNewExt();
                p1.cx = (0);
                p1.cy = (0);
                CT_Point2D p2 = t2d.AddNewOff();
                p2.x = (0);
                p2.y = (0);

                CT_PresetGeometry2D geom = sp.AddNewPrstGeom();
                geom.prst = (ST_ShapeType.line);
                geom.AddNewAvLst();

                CT_ShapeStyle  style  = shape.AddNewStyle();
                CT_SchemeColor scheme = style.AddNewLnRef().AddNewSchemeClr();
                scheme.val      = (ST_SchemeColorVal.accent1);
                style.lnRef.idx = (1);

                CT_StyleMatrixReference fillref = style.AddNewFillRef();
                fillref.idx = (0);
                fillref.AddNewSchemeClr().val = (ST_SchemeColorVal.accent1);

                CT_StyleMatrixReference effectRef = style.AddNewEffectRef();
                effectRef.idx = (0);
                effectRef.AddNewSchemeClr().val = (ST_SchemeColorVal.accent1);

                CT_FontReference fontRef = style.AddNewFontRef();
                fontRef.idx = (ST_FontCollectionIndex.minor);
                fontRef.AddNewSchemeClr().val = (ST_SchemeColorVal.tx1);

                prototype = shape;
            }
            return(prototype);
        }
コード例 #19
0
        public static CT_SurfaceSer Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_SurfaceSer ctObj = new CT_SurfaceSer();

            ctObj.extLst = new List <CT_Extension>();
            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "idx")
                {
                    ctObj.idx = CT_UnsignedInt.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "order")
                {
                    ctObj.order = CT_UnsignedInt.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "tx")
                {
                    ctObj.tx = CT_SerTx.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "spPr")
                {
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "cat")
                {
                    ctObj.cat = CT_AxDataSource.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "val")
                {
                    ctObj.val = CT_NumDataSource.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "extLst")
                {
                    ctObj.extLst.Add(CT_Extension.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
コード例 #20
0
        /**
         * Returns a prototype that is used to construct new shapes
         *
         * @return a prototype that is used to construct new shapes
         */


        internal static CT_Picture Prototype()
        {
            if (prototype == null)
            {
                CT_Picture               pic     = new CT_Picture();
                CT_PictureNonVisual      nvpr    = pic.AddNewNvPicPr();
                CT_NonVisualDrawingProps nvProps = nvpr.AddNewCNvPr();
                nvProps.id    = (1);
                nvProps.name  = ("Picture 1");
                nvProps.descr = ("Picture");
                CT_NonVisualPictureProperties nvPicProps   = nvpr.AddNewCNvPicPr();
                nvPicProps.AddNewPicLocks().noChangeAspect = true;



                CT_BlipFillProperties blip = pic.AddNewBlipFill();
                blip.AddNewBlip().embed    = "";
                blip.AddNewStretch().AddNewFillRect();

                CT_ShapeProperties sppr = pic.AddNewSpPr();
                CT_Transform2D     t2d  = sppr.AddNewXfrm();
                CT_PositiveSize2D  ext  = t2d.AddNewExt();
                //should be original picture width and height expressed in EMUs
                ext.cx = (0);
                ext.cy = (0);

                CT_Point2D off = t2d.AddNewOff();
                off.x = (0);
                off.y = (0);

                CT_PresetGeometry2D prstGeom = sppr.AddNewPrstGeom();
                prstGeom.prst = (ST_ShapeType.rect);
                prstGeom.AddNewAvLst();

                prototype = pic;
            }
            return(prototype);
        }
コード例 #21
0
ファイル: XSSFConnector.cs プロジェクト: thachgiasoft/shuijin
 public static CT_Connector Prototype()
 {
     if (XSSFConnector.prototype == null)
     {
         CT_Connector             ctConnector        = new CT_Connector();
         CT_ConnectorNonVisual    connectorNonVisual = ctConnector.AddNewNvCxnSpPr();
         CT_NonVisualDrawingProps visualDrawingProps = connectorNonVisual.AddNewCNvPr();
         visualDrawingProps.id   = 1U;
         visualDrawingProps.name = "Shape 1";
         connectorNonVisual.AddNewCNvCxnSpPr();
         CT_ShapeProperties ctShapeProperties = ctConnector.AddNewSpPr();
         CT_Transform2D     ctTransform2D     = ctShapeProperties.AddNewXfrm();
         CT_PositiveSize2D  ctPositiveSize2D  = ctTransform2D.AddNewExt();
         ctPositiveSize2D.cx = 0L;
         ctPositiveSize2D.cy = 0L;
         CT_Point2D ctPoint2D = ctTransform2D.AddNewOff();
         ctPoint2D.x = 0L;
         ctPoint2D.y = 0L;
         CT_PresetGeometry2D presetGeometry2D = ctShapeProperties.AddNewPrstGeom();
         presetGeometry2D.prst = ST_ShapeType.line;
         presetGeometry2D.AddNewAvLst();
         CT_ShapeStyle ctShapeStyle = ctConnector.AddNewStyle();
         ctShapeStyle.AddNewLnRef().AddNewSchemeClr().val = ST_SchemeColorVal.accent1;
         ctShapeStyle.lnRef.idx = 1U;
         CT_StyleMatrixReference styleMatrixReference1 = ctShapeStyle.AddNewFillRef();
         styleMatrixReference1.idx = 0U;
         styleMatrixReference1.AddNewSchemeClr().val   = ST_SchemeColorVal.accent1;
         CT_StyleMatrixReference styleMatrixReference2 = ctShapeStyle.AddNewEffectRef();
         styleMatrixReference2.idx = 0U;
         styleMatrixReference2.AddNewSchemeClr().val = ST_SchemeColorVal.accent1;
         CT_FontReference ctFontReference            = ctShapeStyle.AddNewFontRef();
         ctFontReference.idx = ST_FontCollectionIndex.minor;
         ctFontReference.AddNewSchemeClr().val = ST_SchemeColorVal.tx1;
         XSSFConnector.prototype = ctConnector;
     }
     return(XSSFConnector.prototype);
 }
コード例 #22
0
ファイル: BubbleChart.cs プロジェクト: ruo2012/Npoi.Core
        public static CT_BubbleSer Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_BubbleSer ctObj = new CT_BubbleSer();

            ctObj.dPt       = new List <CT_DPt>();
            ctObj.trendline = new List <CT_Trendline>();
            ctObj.errBars   = new List <CT_ErrBars>();
            ctObj.extLst    = new List <CT_Extension>();
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "idx")
                {
                    ctObj.idx = CT_UnsignedInt.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "order")
                {
                    ctObj.order = CT_UnsignedInt.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "tx")
                {
                    ctObj.tx = CT_SerTx.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "spPr")
                {
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "invertIfNegative")
                {
                    ctObj.invertIfNegative = CT_Boolean.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "dLbls")
                {
                    ctObj.dLbls = CT_DLbls.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "xVal")
                {
                    ctObj.xVal = CT_AxDataSource.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "yVal")
                {
                    ctObj.yVal = CT_NumDataSource.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "bubbleSize")
                {
                    ctObj.bubbleSize = CT_NumDataSource.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "bubble3D")
                {
                    ctObj.bubble3D = CT_Boolean.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "dPt")
                {
                    ctObj.dPt.Add(CT_DPt.Parse(childNode, namespaceManager));
                }
                else if (childNode.Name.LocalName == "trendline")
                {
                    ctObj.trendline.Add(CT_Trendline.Parse(childNode, namespaceManager));
                }
                else if (childNode.Name.LocalName == "errBars")
                {
                    ctObj.errBars.Add(CT_ErrBars.Parse(childNode, namespaceManager));
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst.Add(CT_Extension.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
コード例 #23
0
ファイル: Picture.cs プロジェクト: hiodava/Romero
 public CT_ShapeProperties AddNewSpPr()
 {
     spPrField = new CT_ShapeProperties();
     return(this.spPrField);
 }
コード例 #24
0
ファイル: ChartDrawing.cs プロジェクト: Reinakumiko/npoi
 public CT_Shape()
 {
     this.txBodyField = new CT_TextBody();
     this.styleField = new CT_ShapeStyle();
     this.spPrField = new CT_ShapeProperties();
     this.nvSpPrField = new CT_ShapeNonVisual();
     this.fLocksTextField = true;
     this.fPublishedField = false;
 }
コード例 #25
0
ファイル: ShapeProperties.cs プロジェクト: 89sos98/npoi
 public static CT_ShapeProperties Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_ShapeProperties ctObj = new CT_ShapeProperties();
     if (node.Attributes["bwMode"] != null)
         ctObj.bwMode = (ST_BlackWhiteMode)Enum.Parse(typeof(ST_BlackWhiteMode), node.Attributes["bwMode"].Value);
     foreach (XmlNode childNode in node.ChildNodes)
     {
         if (childNode.LocalName == "xfrm")
             ctObj.xfrm = CT_Transform2D.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "custGeom")
             ctObj.custGeom = CT_CustomGeometry2D.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "prstGeom")
             ctObj.prstGeom = CT_PresetGeometry2D.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "noFill")
             ctObj.noFill = new CT_NoFillProperties();
         else if (childNode.LocalName == "solidFill")
             ctObj.solidFill = CT_SolidColorFillProperties.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "gradFill")
             ctObj.gradFill = CT_GradientFillProperties.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "blipFill")
             ctObj.blipFill = CT_BlipFillProperties.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "pattFill")
             ctObj.pattFill = CT_PatternFillProperties.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "grpFill")
             ctObj.grpFill = new CT_GroupFillProperties();
         else if (childNode.LocalName == "ln")
             ctObj.ln = CT_LineProperties.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "effectLst")
             ctObj.effectLst = CT_EffectList.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "effectDag")
             ctObj.effectDag = CT_EffectContainer.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "scene3d")
             ctObj.scene3d = CT_Scene3D.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "sp3d")
             ctObj.sp3d = CT_Shape3D.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "extLst")
             ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
     }
     return ctObj;
 }
コード例 #26
0
ファイル: DiagramDataModel.cs プロジェクト: 89sos98/npoi
 public CT_Pt()
 {
     this.extLstField = new CT_OfficeArtExtensionList();
     this.tField = new CT_TextBody();
     this.spPrField = new CT_ShapeProperties();
     this.prSetField = new CT_ElemPropSet();
     this.typeField = ST_PtType.node;
     this.cxnIdField = "0";
 }
コード例 #27
0
ファイル: XSSFSimpleShape.cs プロジェクト: purehzj/npoi-1
        /**
         * Prototype with the default structure of a new auto-shape.
         */
        internal static CT_Shape Prototype()
        {
            if (prototype == null)
            {
                CT_Shape shape = new CT_Shape();


                CT_ShapeNonVisual        nv  = shape.AddNewNvSpPr();
                CT_NonVisualDrawingProps nvp = nv.AddNewCNvPr();
                nvp.id   = (1);
                nvp.name = ("Shape 1");
                nv.AddNewCNvSpPr();

                CT_ShapeProperties sp  = shape.AddNewSpPr();
                CT_Transform2D     t2d = sp.AddNewXfrm();
                CT_PositiveSize2D  p1  = t2d.AddNewExt();
                p1.cx = (0);
                p1.cy = (0);
                CT_Point2D p2 = t2d.AddNewOff();
                p2.x = (0);
                p2.y = (0);

                CT_PresetGeometry2D geom = sp.AddNewPrstGeom();
                geom.prst = (ST_ShapeType.rect);
                geom.AddNewAvLst();

                CT_ShapeStyle  style  = shape.AddNewStyle();
                CT_SchemeColor scheme = style.AddNewLnRef().AddNewSchemeClr();
                scheme.val = (ST_SchemeColorVal.accent1);
                scheme.AddNewShade().val = 50000;
                style.lnRef.idx = (2);

                CT_StyleMatrixReference Fillref = style.AddNewFillRef();
                Fillref.idx = (1);
                Fillref.AddNewSchemeClr().val = (ST_SchemeColorVal.accent1);

                CT_StyleMatrixReference effectRef = style.AddNewEffectRef();
                effectRef.idx = (0);
                effectRef.AddNewSchemeClr().val = (ST_SchemeColorVal.accent1);

                CT_FontReference fontRef = style.AddNewFontRef();
                fontRef.idx = (ST_FontCollectionIndex.minor);
                fontRef.AddNewSchemeClr().val = (ST_SchemeColorVal.lt1);

                CT_TextBody           body   = shape.AddNewTxBody();
                CT_TextBodyProperties bodypr = body.AddNewBodyPr();
                bodypr.anchor = (ST_TextAnchoringType.ctr);
                bodypr.rtlCol = (false);
                CT_TextParagraph p = body.AddNewP();

                p.AddNewPPr().algn = (ST_TextAlignType.ctr);
                CT_TextCharacterProperties endPr = p.AddNewEndParaRPr();
                endPr.lang = ("en-US");
                endPr.sz   = (1100);

                body.AddNewLstStyle();

                prototype = shape;
            }
            return(prototype);
        }
コード例 #28
0
ファイル: Picture.cs プロジェクト: hanwangkun/npoi
 public CT_ShapeProperties AddNewSpPr()
 {
     spPrField = new CT_ShapeProperties();
     return this.spPrField;
 }
コード例 #29
0
        public static CT_ScatterSer Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_ScatterSer ctObj = new CT_ScatterSer();

            ctObj.dPt       = new List <CT_DPt>();
            ctObj.trendline = new List <CT_Trendline>();
            ctObj.errBars   = new List <CT_ErrBars>();
            ctObj.extLst    = new List <CT_Extension>();
            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "idx")
                {
                    ctObj.idx = CT_UnsignedInt.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "order")
                {
                    ctObj.order = CT_UnsignedInt.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "tx")
                {
                    ctObj.tx = CT_SerTx.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "spPr")
                {
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "marker")
                {
                    ctObj.marker = CT_Marker.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "dLbls")
                {
                    ctObj.dLbls = CT_DLbls.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "xVal")
                {
                    ctObj.xVal = CT_AxDataSource.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "yVal")
                {
                    ctObj.yVal = CT_NumDataSource.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "smooth")
                {
                    ctObj.smooth = CT_Boolean.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "dPt")
                {
                    ctObj.dPt.Add(CT_DPt.Parse(childNode, namespaceManager));
                }
                else if (childNode.LocalName == "trendline")
                {
                    ctObj.trendline.Add(CT_Trendline.Parse(childNode, namespaceManager));
                }
                else if (childNode.LocalName == "errBars")
                {
                    ctObj.errBars.Add(CT_ErrBars.Parse(childNode, namespaceManager));
                }
                else if (childNode.LocalName == "extLst")
                {
                    ctObj.extLst.Add(CT_Extension.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
コード例 #30
0
        /**
         * Adds a picture to the run. This method handles
         *  attaching the picture data to the overall file.
         *
         * @see NPOI.XWPF.UserModel.Document#PICTURE_TYPE_EMF
         * @see NPOI.XWPF.UserModel.Document#PICTURE_TYPE_WMF
         * @see NPOI.XWPF.UserModel.Document#PICTURE_TYPE_PICT
         * @see NPOI.XWPF.UserModel.Document#PICTURE_TYPE_JPEG
         * @see NPOI.XWPF.UserModel.Document#PICTURE_TYPE_PNG
         * @see NPOI.XWPF.UserModel.Document#PICTURE_TYPE_DIB
         *
         * @param pictureData The raw picture data
         * @param pictureType The type of the picture, eg {@link Document#PICTURE_TYPE_JPEG}
         * @param width width in EMUs. To convert to / from points use {@link org.apache.poi.util.Units}
         * @param height height in EMUs. To convert to / from points use {@link org.apache.poi.util.Units}
         * @throws NPOI.Openxml4j.exceptions.InvalidFormatException
         * @throws IOException
         */
        public XWPFPicture AddPicture(Stream pictureData, int pictureType, String filename, int width, int height)
        {
            XWPFDocument doc = parent.Document;

            // Add the picture + relationship
            String          relationId = doc.AddPictureData(pictureData, pictureType);
            XWPFPictureData picData    = (XWPFPictureData)doc.GetRelationById(relationId);

            // Create the Drawing entry for it
            CT_Drawing Drawing = run.AddNewDrawing();
            CT_Inline  inline  = Drawing.AddNewInline();

            // Do the fiddly namespace bits on the inline
            // (We need full control of what goes where and as what)
            //CT_GraphicalObject tmp = new CT_GraphicalObject();
            //String xml =
            //    "<a:graphic xmlns:a=\"" + "http://schemas.openxmlformats.org/drawingml/2006/main" + "\">" +
            //    "<a:graphicData uri=\"" + "http://schemas.openxmlformats.org/drawingml/2006/picture" + "\">" +
            //    "<pic:pic xmlns:pic=\"" + "http://schemas.openxmlformats.org/drawingml/2006/picture" + "\" />" +
            //    "</a:graphicData>" +
            //    "</a:graphic>";
            //inline.Set((xml));

            XmlDocument xmlDoc = new XmlDocument();

            //XmlElement el = xmlDoc.CreateElement("pic", "pic", "http://schemas.openxmlformats.org/drawingml/2006/picture");

            inline.graphic                 = new CT_GraphicalObject();
            inline.graphic.graphicData     = new CT_GraphicalObjectData();
            inline.graphic.graphicData.uri = "http://schemas.openxmlformats.org/drawingml/2006/picture";


            // Setup the inline
            inline.distT = (0);
            inline.distR = (0);
            inline.distB = (0);
            inline.distL = (0);

            NPOI.OpenXmlFormats.Dml.WordProcessing.CT_NonVisualDrawingProps docPr = inline.AddNewDocPr();
            long id = parent.Document.DrawingIdManager.ReserveNew();

            docPr.id = (uint)(id);
            /* This name is not visible in Word 2010 anywhere. */
            docPr.name  = ("Drawing " + id);
            docPr.descr = (filename);

            NPOI.OpenXmlFormats.Dml.WordProcessing.CT_PositiveSize2D extent = inline.AddNewExtent();
            extent.cx = (width);
            extent.cy = (height);

            // Grab the picture object
            NPOI.OpenXmlFormats.Dml.Picture.CT_Picture pic = new OpenXmlFormats.Dml.Picture.CT_Picture();

            // Set it up
            NPOI.OpenXmlFormats.Dml.Picture.CT_PictureNonVisual nvPicPr = pic.AddNewNvPicPr();

            NPOI.OpenXmlFormats.Dml.CT_NonVisualDrawingProps cNvPr = nvPicPr.AddNewCNvPr();
            /* use "0" for the id. See ECM-576, 20.2.2.3 */
            cNvPr.id = (0);
            /* This name is not visible in Word 2010 anywhere */
            cNvPr.name  = ("Picture " + id);
            cNvPr.descr = (filename);

            CT_NonVisualPictureProperties cNvPicPr = nvPicPr.AddNewCNvPicPr();

            cNvPicPr.AddNewPicLocks().noChangeAspect = true;

            CT_BlipFillProperties blipFill = pic.AddNewBlipFill();
            CT_Blip blip = blipFill.AddNewBlip();

            blip.embed = (picData.GetPackageRelationship().Id);
            blipFill.AddNewStretch().AddNewFillRect();

            CT_ShapeProperties spPr = pic.AddNewSpPr();
            CT_Transform2D     xfrm = spPr.AddNewXfrm();

            CT_Point2D off = xfrm.AddNewOff();

            off.x = (0);
            off.y = (0);

            NPOI.OpenXmlFormats.Dml.CT_PositiveSize2D ext = xfrm.AddNewExt();
            ext.cx = (width);
            ext.cy = (height);

            CT_PresetGeometry2D prstGeom = spPr.AddNewPrstGeom();

            prstGeom.prst = (ST_ShapeType.rect);
            prstGeom.AddNewAvLst();

            using (var ms = new MemoryStream())
            {
                StreamWriter sw = new StreamWriter(ms);
                pic.Write(sw, "pic:pic");
                sw.Flush();
                ms.Position = 0;
                var sr     = new StreamReader(ms);
                var picXml = sr.ReadToEnd();
                inline.graphic.graphicData.AddPicElement(picXml);
            }
            // Finish up
            XWPFPicture xwpfPicture = new XWPFPicture(pic, this);

            pictures.Add(xwpfPicture);
            return(xwpfPicture);
        }
コード例 #31
0
ファイル: XWPFRun.cs プロジェクト: Yvees/npoi
        XWPFPicture AddPicture(Stream pictureData, int pictureType, String filename, int width, int height, Action <XWPFDocument, CT_Blip> extAct)
        {
            // Add the picture + relationship
            String          relationId;
            XWPFPictureData picData;
            XWPFDocument    doc = null;

            // Work out what to add the picture to, then add both the
            //  picture and the relationship for it
            // TODO Should we have an interface for this sort of thing?
            if (parent.Part is XWPFHeaderFooter)
            {
                XWPFHeaderFooter headerFooter = (XWPFHeaderFooter)parent.Part;
                relationId = headerFooter.AddPictureData(pictureData, pictureType);
                picData    = (XWPFPictureData)headerFooter.GetRelationById(relationId);
            }
            else
            {
                doc        = parent.Document;
                relationId = doc.AddPictureData(pictureData, pictureType);
                picData    = (XWPFPictureData)doc.GetRelationById(relationId);
            }

            try
            {
                // Create the Drawing entry for it
                CT_Drawing Drawing = run.AddNewDrawing();
                CT_Inline  inline  = Drawing.AddNewInline();

                // Do the fiddly namespace bits on the inline
                // (We need full control of what goes where and as what)
                //CT_GraphicalObject tmp = new CT_GraphicalObject();
                //String xml =
                //    "<a:graphic xmlns:a=\"" + "http://schemas.openxmlformats.org/drawingml/2006/main" + "\">" +
                //    "<a:graphicData uri=\"" + "http://schemas.openxmlformats.org/drawingml/2006/picture" + "\">" +
                //    "<pic:pic xmlns:pic=\"" + "http://schemas.openxmlformats.org/drawingml/2006/picture" + "\" />" +
                //    "</a:graphicData>" +
                //    "</a:graphic>";
                //InputSource is = new InputSource(new StringReader(xml));
                //org.w3c.dom.Document doc = DocumentHelper.readDocument(is);
                //inline.set(XmlToken.Factory.parse(doc.getDocumentElement(), DEFAULT_XML_OPTIONS));

                inline.graphic                 = new CT_GraphicalObject();
                inline.graphic.graphicData     = new CT_GraphicalObjectData();
                inline.graphic.graphicData.uri = "http://schemas.openxmlformats.org/drawingml/2006/picture";


                // Setup the inline
                inline.distT = (0);
                inline.distR = (0);
                inline.distB = (0);
                inline.distL = (0);

                NPOI.OpenXmlFormats.Dml.WordProcessing.CT_NonVisualDrawingProps docPr = inline.AddNewDocPr();
                long id = parent.Document.DrawingIdManager.ReserveNew();
                docPr.id = (uint)(id);
                /* This name is not visible in Word 2010 anywhere. */
                docPr.name  = ("Drawing " + id);
                docPr.descr = (filename);

                NPOI.OpenXmlFormats.Dml.WordProcessing.CT_PositiveSize2D extent = inline.AddNewExtent();
                extent.cx = (width);
                extent.cy = (height);

                // Grab the picture object
                NPOI.OpenXmlFormats.Dml.Picture.CT_Picture pic = new OpenXmlFormats.Dml.Picture.CT_Picture();

                // Set it up
                NPOI.OpenXmlFormats.Dml.Picture.CT_PictureNonVisual nvPicPr = pic.AddNewNvPicPr();

                NPOI.OpenXmlFormats.Dml.CT_NonVisualDrawingProps cNvPr = nvPicPr.AddNewCNvPr();
                /* use "0" for the id. See ECM-576, 20.2.2.3 */
                cNvPr.id = (0);
                /* This name is not visible in Word 2010 anywhere */
                cNvPr.name  = ("Picture " + id);
                cNvPr.descr = (filename);

                CT_NonVisualPictureProperties cNvPicPr   = nvPicPr.AddNewCNvPicPr();
                cNvPicPr.AddNewPicLocks().noChangeAspect = true;

                CT_BlipFillProperties blipFill = pic.AddNewBlipFill();
                CT_Blip blip = blipFill.AddNewBlip();
                blip.embed = (picData.GetPackageRelationship().Id);
                if (doc != null)
                {
                    extAct(doc, blip);
                }
                blipFill.AddNewStretch().AddNewFillRect();

                CT_ShapeProperties spPr = pic.AddNewSpPr();
                CT_Transform2D     xfrm = spPr.AddNewXfrm();

                CT_Point2D off = xfrm.AddNewOff();
                off.x = (0);
                off.y = (0);

                NPOI.OpenXmlFormats.Dml.CT_PositiveSize2D ext = xfrm.AddNewExt();
                ext.cx = (width);
                ext.cy = (height);

                CT_PresetGeometry2D prstGeom = spPr.AddNewPrstGeom();
                prstGeom.prst = (ST_ShapeType.rect);
                prstGeom.AddNewAvLst();

                using (var ms = new MemoryStream())
                {
                    StreamWriter sw = new StreamWriter(ms);
                    pic.Write(sw, "pic:pic");
                    sw.Flush();
                    ms.Position = 0;
                    var sr     = new StreamReader(ms);
                    var picXml = sr.ReadToEnd();
                    inline.graphic.graphicData.AddPicElement(picXml);
                }
                // Finish up
                XWPFPicture xwpfPicture = new XWPFPicture(pic, this);
                pictures.Add(xwpfPicture);
                return(xwpfPicture);
            }
            catch (XmlException e)
            {
                throw new InvalidOperationException("XWPFRun.Addpicture error", e);
            }
        }
コード例 #32
0
ファイル: BarChart.cs プロジェクト: zzy092/npoi
        public static CT_BarSer Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_BarSer ctObj = new CT_BarSer();

            ctObj.dPt       = new List <CT_DPt>();
            ctObj.trendline = new List <CT_Trendline>();
            ctObj.extLst    = new List <CT_Extension>();
            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "idx")
                {
                    ctObj.idx = CT_UnsignedInt.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "order")
                {
                    ctObj.order = CT_UnsignedInt.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "tx")
                {
                    ctObj.tx = CT_SerTx.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "spPr")
                {
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "invertIfNegative")
                {
                    ctObj.invertIfNegative = CT_Boolean.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "pictureOptions")
                {
                    ctObj.pictureOptions = CT_PictureOptions.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "dLbls")
                {
                    ctObj.dLbls = CT_DLbls.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "errBars")
                {
                    ctObj.errBars = CT_ErrBars.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "cat")
                {
                    ctObj.cat = CT_AxDataSource.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "val")
                {
                    ctObj.val = CT_NumDataSource.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "shape")
                {
                    ctObj.shape = CT_Shape.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "dPt")
                {
                    ctObj.dPt.Add(CT_DPt.Parse(childNode, namespaceManager));
                }
                else if (childNode.LocalName == "trendline")
                {
                    ctObj.trendline.Add(CT_Trendline.Parse(childNode, namespaceManager));
                }
                else if (childNode.LocalName == "extLst")
                {
                    ctObj.extLst.Add(CT_Extension.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }