Example #1
0
        /// <summary>
        /// 加载xml
        /// </summary>
        /// <param name="p_reader"></param>
        public void ReadXml(XmlReader p_reader)
        {
            if (p_reader == null || p_reader.IsEmptyElement || p_reader.Name != "Rpt")
            {
                throw new Exception("加载报表模板根节点时出错!");
            }

            // 报表列宽
            Cols = RptPart.SplitSize(p_reader.GetAttribute("cols"));

            // 模板内容
            p_reader.Read();
            while (p_reader.NodeType != XmlNodeType.None)
            {
                if (p_reader.NodeType == XmlNodeType.EndElement && p_reader.Name == "Rpt")
                {
                    break;
                }

                switch (p_reader.Name)
                {
                case "Params":
                    Params.ReadXml(p_reader);
                    break;

                case "Data":
                    Data.ReadXml(p_reader);
                    break;

                case "Page":
                    PageSetting.ReadXml(p_reader);
                    break;

                case "Header":
                    Header.ReadXml(p_reader);
                    break;

                case "Body":
                    Body.ReadXml(p_reader);
                    break;

                case "Footer":
                    Footer.ReadXml(p_reader);
                    break;

                case "View":
                    ViewSetting.ReadXml(p_reader);
                    break;
                }
            }
        }