Ejemplo n.º 1
0
        /**
         * Initialize default structure of a new graphic frame
         */
        public static CT_GraphicalObjectFrame Prototype()
        {
            if (prototype == null)
            {
                CT_GraphicalObjectFrame graphicFrame = new CT_GraphicalObjectFrame();

                NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_GraphicalObjectFrameNonVisual nvGraphic = graphicFrame.AddNewNvGraphicFramePr();
                NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_NonVisualDrawingProps         props     = nvGraphic.AddNewCNvPr();
                props.id   = (0);
                props.name = ("Diagramm 1");
                nvGraphic.AddNewCNvGraphicFramePr();



                NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_Transform2D transform = graphicFrame.AddNewXfrm();
                CT_PositiveSize2D extPoint = transform.AddNewExt();
                CT_Point2D        offPoint = transform.AddNewOff();

                extPoint.cx = (0);
                extPoint.cy = (0);
                offPoint.x  = (0);
                offPoint.y  = (0);

                CT_GraphicalObject graphic = graphicFrame.AddNewGraphic();

                prototype = graphicFrame;
            }
            return(prototype);
        }
Ejemplo n.º 2
0
 public void Set(CT_GraphicalObjectFrame obj)
 {
     this.xfrmField = obj.xfrmField;
     this.graphicField = obj.graphicField;
     this.nvGraphicFramePrField = obj.nvGraphicFramePrField;
     this.macroField = obj.macroField;
     this.fPublishedField = obj.fPublishedField;
 }
Ejemplo n.º 3
0
        public XSSFChildAnchor(int x, int y, int cx, int cy)
        {
            t2d = new NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_Transform2D();
            CT_Point2D off = t2d.AddNewOff();
            CT_PositiveSize2D ext = t2d.AddNewExt();

            off.x = (x);
            off.y = (y);
            ext.cx = (Math.Abs(cx - x));
            ext.cy = (Math.Abs(cy - y));
            if (x > cx) t2d.flipH = (true);
            if (y > cy) t2d.flipV = (true);
        }
Ejemplo n.º 4
0
        /**
         * Initialize default structure of a new auto-shape
         *
         */
        public static CT_Connector Prototype()
        {
            CT_Connector          shape = new CT_Connector();
            CT_ConnectorNonVisual nv    = shape.AddNewNvCxnSpPr();

            NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_NonVisualDrawingProps nvp = nv.AddNewCNvPr();
            nvp.id   = (1);
            nvp.name = ("Shape 1");
            nv.AddNewCNvCxnSpPr();

            NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_ShapeProperties sp  = shape.AddNewSpPr();
            NPOI.OpenXmlFormats.Dml.Spreadsheet.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();

            NPOI.OpenXmlFormats.Dml.Spreadsheet.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);
        }
Ejemplo n.º 5
0
 public static CT_Transform2D Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_Transform2D ctObj = new CT_Transform2D();
     ctObj.rot = XmlHelper.ReadInt(node.Attributes["rot"]);
     ctObj.flipH = XmlHelper.ReadBool(node.Attributes["flipH"]);
     ctObj.flipV = XmlHelper.ReadBool(node.Attributes["flipV"]);
     foreach (XmlNode childNode in node.ChildNodes)
     {
         if (childNode.LocalName == "off")
             ctObj.off = CT_Point2D.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "ext")
             ctObj.ext = CT_PositiveSize2D.Parse(childNode, namespaceManager);
     }
     return ctObj;
 }
Ejemplo n.º 6
0
        public XSSFChildAnchor(int x, int y, int cx, int cy)
        {
            t2d = new NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_Transform2D();
            CT_Point2D        off = t2d.AddNewOff();
            CT_PositiveSize2D ext = t2d.AddNewExt();

            off.x  = (x);
            off.y  = (y);
            ext.cx = (Math.Abs(cx - x));
            ext.cy = (Math.Abs(cy - y));
            if (x > cx)
            {
                t2d.flipH = (true);
            }
            if (y > cy)
            {
                t2d.flipV = (true);
            }
        }
Ejemplo n.º 7
0
        /**
         * Prototype with the default structure of a new auto-shape.
         */
        protected internal static CT_Shape GetPrototype()
        {
            if (prototype == null)
            {
                CT_Shape shape = new CT_Shape();

                CT_ShapeNonVisual nv = shape.AddNewNvSpPr();
                NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_NonVisualDrawingProps nvp = nv.AddNewCNvPr();
                nvp.id   = (/*setter*/ 1);
                nvp.name = (/*setter*/ "Shape 1");
                nv.AddNewCNvSpPr();

                NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_ShapeProperties sp  = shape.AddNewSpPr();
                NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_Transform2D     t2d = sp.AddNewXfrm();
                CT_PositiveSize2D p1 = t2d.AddNewExt();
                p1.cx = (/*setter*/ 0);
                p1.cy = (/*setter*/ 0);
                CT_Point2D p2 = t2d.AddNewOff();
                p2.x = (/*setter*/ 0);
                p2.y = (/*setter*/ 0);

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

                NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_TextBody body = shape.AddNewTxBody();
                CT_TextBodyProperties bodypr = body.AddNewBodyPr();
                bodypr.anchor = (/*setter*/ ST_TextAnchoringType.t);
                bodypr.rtlCol = (/*setter*/ false);
                CT_TextParagraph p = body.AddNewP();
                p.AddNewPPr().algn = (/*setter*/ ST_TextAlignType.l);
                CT_TextCharacterProperties endPr = p.AddNewEndParaRPr();
                endPr.lang = (/*setter*/ "en-US");
                endPr.sz   = (/*setter*/ 1100);
                CT_SolidColorFillProperties scfpr = endPr.AddNewSolidFill();
                scfpr.AddNewSrgbClr().val         = (/*setter*/ new byte[] { 0, 0, 0 });

                body.AddNewLstStyle();

                prototype = shape;
            }
            return(prototype);
        }
Ejemplo n.º 8
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();
            NPOI.OpenXmlFormats.Dml.Spreadsheet.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.º 9
0
 public XSSFChildAnchor(NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_Transform2D t2d)
 {
     this.t2d = t2d;
 }
Ejemplo n.º 10
0
 public CT_Transform2D AddNewXfrm()
 {
     this.xfrmField = new CT_Transform2D();
     return this.xfrmField;
 }
Ejemplo n.º 11
0
 public XSSFChildAnchor(NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_Transform2D t2d)
 {
     this.t2d = t2d;
 }