Exemple #1
0
        public static CT_ShapeStyle Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_ShapeStyle ctObj = new CT_ShapeStyle();

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "lnRef")
                {
                    ctObj.lnRef = CT_StyleMatrixReference.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "fillRef")
                {
                    ctObj.fillRef = CT_StyleMatrixReference.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "effectRef")
                {
                    ctObj.effectRef = CT_StyleMatrixReference.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "fontRef")
                {
                    ctObj.fontRef = CT_FontReference.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
        /**
         * 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);
        }
 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);
 }
 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);
 }
Exemple #5
0
        /**
         * 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);
        }
Exemple #6
0
 public CT_StyleMatrixReference AddNewEffectRef()
 {
     this.effectRefField = new CT_StyleMatrixReference();
     return(this.effectRefField);
 }
Exemple #7
0
 public CT_StyleMatrixReference AddNewLnRef()
 {
     this.lnRefField = new CT_StyleMatrixReference();
     return(this.lnRefField);
 }
 public CT_StyleMatrixReference AddNewEffectRef()
 {
     this.effectRefField = new CT_StyleMatrixReference();
     return this.effectRefField;
 }
 public CT_StyleMatrixReference AddNewLnRef()
 {
     this.lnRefField = new CT_StyleMatrixReference();
     return this.lnRefField;
 }