Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public static CT_GroupShape Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_GroupShape ctObj = new CT_GroupShape();

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "nvGrpSpPr")
                {
                    ctObj.nvGrpSpPr = CT_GroupShapeNonVisual.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "grpSpPr")
                {
                    ctObj.grpSpPr = CT_GroupShapeProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "pic")
                {
                    var pic = CT_Picture.Parse(childNode, namespaceManager);
                    ctObj.pictures.Add(pic);
                }
                else if (childNode.LocalName == "sp")
                {
                    var shape = CT_Shape.Parse(childNode, namespaceManager);
                    ctObj.shapes.Add(shape);
                }
            }
            return(ctObj);
        }
Esempio n. 3
0
        public CT_Picture AddNewPic()
        {
            var pic = new CT_Picture();

            pictures.Add(pic);
            return(pic);
        }
Esempio n. 4
0
 public void Set(CT_Picture pict)
 {
     this.nvPicPr             = pict.nvPicPr;
     this.spPr                = pict.spPr;
     this.macro               = pict.macro;
     this.macroSpecified      = this.macroSpecified;
     this.style               = pict.style;
     this.styleSpecified      = pict.styleSpecified;
     this.fPublished          = pict.fPublished;
     this.fPublishedSpecified = pict.fPublishedSpecified;
     this.blipFill            = pict.blipFill;
 }
Esempio n. 5
0
        /**
         * Creates a picture.
         *
         * @param anchor    the client anchor describes how this picture is attached to the sheet.
         * @param pictureIndex the index of the picture in the workbook collection of pictures,
         *   {@link NPOI.xssf.usermodel.XSSFWorkbook#getAllPictures()} .
         *
         * @return  the newly Created picture shape.
         */
        public IPicture CreatePicture(XSSFClientAnchor anchor, int pictureIndex)
        {
            PackageRelationship rel = AddPictureReference(pictureIndex);

            long             shapeId  = newShapeId();
            CT_TwoCellAnchor ctAnchor = CreateTwoCellAnchor(anchor);

            NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_Picture ctShape = ctAnchor.AddNewPic();
            ctShape.Set(XSSFPicture.Prototype());

            ctShape.nvPicPr.cNvPr.id = (uint)shapeId;

            XSSFPicture shape = new XSSFPicture(this, ctShape);

            shape.anchor = anchor;
            shape.SetPictureReference(rel);
            return(shape);
        }
Esempio n. 6
0
 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;
 }
Esempio n. 7
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;
        }
Esempio n. 8
0
 public CT_Picture AddNewPic()
 {
     pictureField = new CT_Picture();
     return pictureField;
 }
Esempio n. 9
0
 public CT_Picture AddNewPic()
 {
     pictureField = new CT_Picture();
     return(pictureField);
 }
Esempio n. 10
0
 /**
  * Construct a new XSSFPicture object. This constructor is called from
  *  {@link XSSFDrawing#CreatePicture(XSSFClientAnchor, int)}
  *
  * @param Drawing the XSSFDrawing that owns this picture
  */
 public XSSFPicture(XSSFDrawing drawing, CT_Picture ctPicture)
 {
     this.drawing = drawing;
     this.ctPicture = ctPicture;
 }
Esempio n. 11
0
 /**
  * Returns a prototype that is used to construct new shapes
  *
  * @return a prototype that is used to construct new shapes
  */
 public XSSFPicture(XSSFDrawing drawing, XmlNode ctPicture)
 {
     this.drawing = drawing;
     this.ctPicture =CT_Picture.Parse(ctPicture, POIXMLDocumentPart.NamespaceManager);
 }
Esempio n. 12
0
        public void Set(CT_Picture pict)
        {
            this.nvPicPr = pict.nvPicPr;
            this.spPr = pict.spPr;
            this.macro = pict.macro;
            this.macroSpecified = this.macroSpecified;
            this.style = pict.style;
            this.styleSpecified = pict.styleSpecified;
            this.fPublished = pict.fPublished;
            this.fPublishedSpecified = pict.fPublishedSpecified;
            this.blipFill = pict.blipFill;
            

        }