示例#1
0
文件: Text.cs 项目: xewn/Npoi.Core
        public static CT_TextBody Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_TextBody ctObj = new CT_TextBody();

            ctObj.p = new List <CT_TextParagraph>();
            foreach (XElement childNode in node.ChildElements())
            {
                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 == "p")
                {
                    ctObj.p.Add(CT_TextParagraph.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
示例#2
0
文件: Text.cs 项目: xewn/Npoi.Core
        public CT_TextParagraph AddNewP()
        {
            if (this.pField == null)
            {
                pField = new List <CT_TextParagraph>();
            }
            CT_TextParagraph tp = new CT_TextParagraph();

            pField.Add(tp);
            return(tp);
        }
示例#3
0
        public static CT_TextParagraph Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_TextParagraph ctObj = new CT_TextParagraph();

            ctObj.r     = new List <CT_RegularTextRun>();
            ctObj.br    = new List <CT_TextLineBreak>();
            ctObj.fld   = new List <CT_TextField>();
            ctObj.items = new List <object>();
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "pPr")
                {
                    ctObj.pPr = CT_TextParagraphProperties.Parse(childNode, namespaceManager);
                    ctObj.items.Add(ctObj.pPr);
                }
                else if (childNode.Name.LocalName == "endParaRPr")
                {
                    ctObj.endParaRPr = CT_TextCharacterProperties.Parse(childNode, namespaceManager);
                    ctObj.items.Add(ctObj.endParaRPr);
                }
                else if (childNode.Name.LocalName == "r")
                {
                    CT_RegularTextRun r = CT_RegularTextRun.Parse(childNode, namespaceManager);
                    ctObj.r.Add(r);
                    ctObj.items.Add(r);
                }
                else if (childNode.Name.LocalName == "br")
                {
                    CT_TextLineBreak br = CT_TextLineBreak.Parse(childNode, namespaceManager);
                    ctObj.br.Add(br);
                    ctObj.items.Add(br);
                }
                else if (childNode.Name.LocalName == "fld")
                {
                    CT_TextField fld = CT_TextField.Parse(childNode, namespaceManager);
                    ctObj.fld.Add(fld);
                    ctObj.items.Add(fld);
                }
            }
            return(ctObj);
        }