示例#1
0
        /// <summary>
        /// 初始化报表
        /// </summary>
        public void  InitReport()
        {
            ReportAnalasis RA = new ReportAnalasis(reportFilePath, startTime, endTime, interVal);

            //读取报表类型
            ReportType = RA.ReportType;
            //读取报表变量
            RA.GetReportTags(out DenseTags, out SloppyTags);
            //读取表头
            Header = RA.GetReportHead();
            //读取表体
            Body = RA.GetReportBody();
            //读取表尾
            Foot = RA.GetReportFoot();
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="fileName"></param>
        public ReportAnalasis(string fileName, string starttime, string endtime, string step)
        {
            xmlFileName = fileName;
            XmlReaderSettings settings = new XmlReaderSettings();

            settings.IgnoreComments = true;               //忽略注释
            XmlReader reader = XmlReader.Create(@fileName, settings);

            xmlDocument.Load(reader);
            root = xmlDocument.SelectSingleNode("Report");
            //读取报表类型
            ReportType = GetReportType();
            //报表行数
            RowCount = (int)(DateTime.Parse(endtime) - DateTime.Parse(starttime)).TotalHours / int.Parse(step);
            //小时间隔
            HourStep  = int.Parse(step);
            startTime = starttime;
            endTime   = endtime;
            this.step = step;
        }