Ejemplo n.º 1
0
        internal static CT_Picture Prototype()
        {
            CT_Picture          pic  = new CT_Picture();
            CT_PictureNonVisual nvpr = pic.AddNewNvPicPr();

            NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_NonVisualDrawingProps nvProps = nvpr.AddNewCNvPr();
            nvProps.id    = (1);
            nvProps.name  = ("Picture 1");
            nvProps.descr = ("Picture");
            NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_NonVisualPictureProperties nvPicProps = nvpr.AddNewCNvPicPr();
            nvPicProps.AddNewPicLocks().noChangeAspect = true;



            NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_BlipFillProperties blip = pic.AddNewBlipFill();
            blip.AddNewBlip().embed = "";
            blip.AddNewStretch().AddNewFillRect();

            NPOI.OpenXmlFormats.Dml.Spreadsheet.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);
        }
Ejemplo n.º 2
0
 public static CT_NonVisualPictureProperties Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_NonVisualPictureProperties ctObj = new CT_NonVisualPictureProperties();
     ctObj.preferRelativeResize = XmlHelper.ReadBool(node.Attributes["preferRelativeResize"]);
     foreach (XmlNode childNode in node.ChildNodes)
     {
         if (childNode.LocalName == "picLocks")
             ctObj.picLocks = CT_PictureLocking.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "extLst")
             ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
     }
     return ctObj;
 }
Ejemplo n.º 3
0
 public CT_NonVisualPictureProperties AddNewCNvPicPr()
 {
     this.cNvPicPrField = new CT_NonVisualPictureProperties();
     return this.cNvPicPrField;
 }