コード例 #1
0
        public static SstDocument Parse(XDocument xml, XmlNamespaceManager namespaceManager)
        {
            try
            {
                SstDocument sstDoc = new SstDocument();
                sstDoc.AddNewSst();
                CT_Sst sst = sstDoc.GetSst();
                sst.count       = XmlHelper.ReadInt(xml.Document.Root.Attribute("count"));
                sst.uniqueCount = XmlHelper.ReadInt(xml.Document.Root.Attribute("uniqueCount"));

                var nl = xml.XPathSelectElements("//d:sst/d:si", namespaceManager);
                if (nl != null)
                {
                    foreach (XElement node in nl)
                    {
                        CT_Rst rst = CT_Rst.Parse(node, namespaceManager);
                        sstDoc.sst.si.Add(rst);
                    }
                }
                return(sstDoc);
            }
            catch (XmlException e)
            {
                throw new IOException(e.Message);
            }
        }
コード例 #2
0
ファイル: CT_Rst.cs プロジェクト: xewn/Npoi.Core
        public static CT_Rst Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            CT_Rst ctObj = new CT_Rst();

            ctObj.r   = new List <CT_RElt>();
            ctObj.rPh = new List <CT_PhoneticRun>();
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "phoneticPr")
                {
                    ctObj.phoneticPr = CT_PhoneticPr.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "r")
                {
                    ctObj.r.Add(CT_RElt.Parse(childNode, namespaceManager));
                }
                else if (childNode.Name.LocalName == "rPh")
                {
                    ctObj.rPh.Add(CT_PhoneticRun.Parse(childNode, namespaceManager));
                }
                else if (childNode.Name.LocalName == "t")
                {
                    ctObj.t = childNode.Value.Replace("\r", "");
                }
            }
            return(ctObj);
        }
コード例 #3
0
ファイル: CT_Rst.cs プロジェクト: xewn/Npoi.Core
        private CT_PhoneticPr phoneticPrField = null;  // optional field

        public void Set(CT_Rst o)
        {
            this.tField          = o.tField;
            this.rField          = o.rField;
            this.rPhField        = o.rPhField;
            this.phoneticPrField = o.phoneticPrField;
        }
コード例 #4
0
ファイル: CT_Cell.cs プロジェクト: ruo2012/Npoi.Core
 //public CT_Cell()
 //{
 //    this.extLstField = new CT_ExtensionList();
 //    //this.isField = new CT_Rst();
 //    //this.fField = new CT_CellFormula();
 //    this.sField = (uint)(0);
 //    this.tField = ST_CellType.n;
 //    this.cmField = ((uint)(0));
 //    this.vmField = ((uint)(0));
 //    this.phField = false;
 //}
 public void Set(CT_Cell cell)
 {
     fField      = cell.fField;
     vField      = cell.vField;
     isField     = cell.isField;
     extLstField = cell.extLstField;
     rField      = cell.rField;
     sField      = cell.sField;
     tField      = cell.tField;
     cmField     = cell.cmField;
     vmField     = cell.vmField;
     phField     = cell.phField;
 }
コード例 #5
0
ファイル: CT_Cell.cs プロジェクト: ruo2012/Npoi.Core
        public static CT_Cell Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Cell ctObj = new CT_Cell();

            ctObj.r = XmlHelper.ReadString(node.Attribute("r"));
            ctObj.s = XmlHelper.ReadUInt(node.Attribute("s"));
            if (node.Attribute("t") != null)
            {
                ctObj.t = (ST_CellType)Enum.Parse(typeof(ST_CellType), node.Attribute("t").Value);
            }
            ctObj.cm = XmlHelper.ReadUInt(node.Attribute("cm"));
            ctObj.vm = XmlHelper.ReadUInt(node.Attribute("vm"));
            ctObj.ph = XmlHelper.ReadBool(node.Attribute("ph"));
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "f")
                {
                    ctObj.f = CT_CellFormula.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "v")
                {
                    ctObj.v = childNode.Value;
                }
                else if (childNode.Name.LocalName == "is")
                {
                    ctObj.@is = CT_Rst.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
コード例 #6
0
ファイル: CT_Comment.cs プロジェクト: ruo2012/Npoi.Core
        private string guidField = null;         // optional attribute

        //public CT_Comment()
        //{
        //    this.textField = new CT_Rst();
        //}
        public static CT_Comment Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Comment ctObj = new CT_Comment();

            ctObj.@ref = XmlHelper.ReadString(node.Attribute("ref"));
            if (node.Attribute("authorId") != null)
            {
                ctObj.authorId = XmlHelper.ReadUInt(node.Attribute("authorId"));
            }
            ctObj.guid = XmlHelper.ReadString(node.Attribute("guid"));
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "text")
                {
                    ctObj.text = CT_Rst.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
コード例 #7
0
ファイル: CT_Cell.cs プロジェクト: ruo2012/Npoi.Core
 public void unsetIs()
 {
     this.isField = null;
 }