コード例 #1
0
        /// <summary>
        ///  根据报表对象构建对应的xml 文档字符窜。
        /// </summary>
        /// <param name="pReport"></param>
        /// <returns></returns>
        public string BuildXMLString(DIYReport.ReportModel.RptReport pReport)
        {
            StringBuilder xmlSB = new StringBuilder();

            //描述
            xmlSB.Append("<?xml version='1.0' encoding='utf-8' ?>");
            xmlSB.Append("<!-- 用户自定义智能报表中心生成的报表 -->");

            writeFirstMarker(xmlSB, pReport.GetType().FullName);
            xmlSB.Append(reportString(pReport));
            DIYReport.ReportModel.RptSectionList sectionList = pReport.SectionList;

            writeFirstMarker(xmlSB, ReportXmlHelper.SECTION_LIST_MARKER);
            foreach (DIYReport.ReportModel.RptSection section in  sectionList)
            {
                writeFirstMarker(xmlSB, section.GetType().FullName);

                xmlSB.Append(sectionString(section));
                writeFirstMarker(xmlSB, ReportXmlHelper.RPT_OBJ_LIST_MARKER);
                DIYReport.ReportModel.RptSingleObjList rptObjList = section.RptObjList;
                foreach (DIYReport.Interface.IRptSingleObj rptObj in rptObjList)
                {
                    writeFirstMarker(xmlSB, rptObj.GetType().FullName);
                    xmlSB.Append(objectToXml(rptObj));
                    writeLastMarker(xmlSB, rptObj.GetType().FullName);
                }
                writeLastMarker(xmlSB, ReportXmlHelper.RPT_OBJ_LIST_MARKER);
                writeLastMarker(xmlSB, section.GetType().FullName);
            }
            writeLastMarker(xmlSB, ReportXmlHelper.SECTION_LIST_MARKER);
            writeLastMarker(xmlSB, pReport.GetType().FullName);
            return(xmlSB.ToString());
        }
コード例 #2
0
 //增加Section
 private void addSections(DIYReport.ReportModel.RptSectionList pSections)
 {
     foreach (DIYReport.ReportModel.RptSection section in pSections)
     {
         string txt = section.Name + ":" + Enum.GetName(section.SectionType.GetType(), section.SectionType);
         cobControls.Items.Add(new  DataStrtuct(txt, section));
         addRptObjList(section.RptObjList);
     }
 }
コード例 #3
0
 public ReportDrawInfo(DIYReport.ReportModel.RptReport _Report)
 {
     DIYReport.ReportModel.RptSectionList sectionList = _Report.SectionList;
     _TitleHeight      = sectionList.GetSectionHeightByType(DIYReport.SectionType.ReportTitle);
     _PageHeadHeight   = sectionList.GetSectionHeightByType(DIYReport.SectionType.PageHead);
     _DetailHeight     = sectionList.GetSectionHeightByType(DIYReport.SectionType.Detail);
     _PageFooterHeight = sectionList.GetSectionHeightByType(DIYReport.SectionType.PageFooter);
     _BottomHeight     = sectionList.GetSectionHeightByType(DIYReport.SectionType.ReportBottom);
 }
コード例 #4
0
 /// <summary>
 /// 通过Data Section List 设置 Design Section List 的数据信息
 /// </summary>
 /// <param name="pDataSectionList"></param>
 public void SetDataSectionList(DIYReport.ReportModel.RptSectionList pDataSectionList)
 {
     foreach (DIYReport.ReportModel.RptSection section in pDataSectionList)
     {
         DesignSection dse = GetSectionByType(section.SectionType);
         if (dse != null)
         {
             dse.SetDataSection(section);
         }
     }
     //ReizeSectionsLocation( (DesignSection)null );
     RefreshDesignLayout();
 }
コード例 #5
0
        /// <summary>
        /// 创建一个新的Section List
        /// </summary>
        public void CreateNewSectionList()
        {
            _DataObj = _Report.DataObj.SectionList;

            foreach (DIYReport.ReportModel.RptSection dataSection in  _DataObj)
            {
                DesignSection section = new DesignSection(dataSection);
                section.IsDisplay = true;
                SectionCaption caption = new SectionCaption();
                section.CaptionCtl = caption;
                this.Add(section);
            }
            RefreshDesignLayout();
            _DataObj.BeforeRemoveSection   += new DIYReport.ReportModel.RptSectionEventHandler(_DataObj_BeforeRemoveSection);
            _DataObj._fterCreateNewSection += new System.EventHandler(_DataObj_AfterCreateNewSection);
        }
コード例 #6
0
ファイル: ReportDataIO.cs プロジェクト: ewin66/CsharpProjects
        private string buildXMLString(DIYReport.ReportModel.RptReport pReport)
        {
            StringBuilder xmlSB = new StringBuilder();

            //描述
            xmlSB.Append("<?xml version='1.0' encoding='utf-8' ?>");
            xmlSB.Append("<!-- 用户自定义智能报表中心生成的报表 -->");
            xmlSB.Append(reportString(pReport));
            DIYReport.ReportModel.RptSectionList sectionList = pReport.SectionList;
            foreach (DIYReport.ReportModel.RptSection section in  sectionList)
            {
                xmlSB.Append(sectionString(section));
                DIYReport.ReportModel.RptSingleObjList rptObjList = section.RptObjList;
                foreach (DIYReport.Interface.IRptSingleObj rptObj in rptObjList)
                {
                    xmlSB.Append(rptObjString(rptObj));
                }
                xmlSB.Append("</RptSection>");
            }
            xmlSB.Append("</RptReport>");
            return(xmlSB.ToString());
        }
コード例 #7
0
        //构造排序的字符窜
        private static string getSortStr(DataTable pDt, DIYReport.ReportModel.RptReport pDataReport)
        {
            DIYReport.ReportModel.RptSectionList sectionList = pDataReport.SectionList;
            string filterStr = "";

            foreach (DIYReport.ReportModel.RptSection section in sectionList)
            {
                if (section.SectionType == DIYReport.SectionType.GroupHead)
                {
                    string asc   = section.GroupField.IsAscending ? " ASC ," :" DESC ,";
                    string sname = section.GroupField.FieldName;
                    if (pDt.Columns.Contains(sname))
                    {
                        filterStr += section.GroupField.FieldName + asc;
                    }
                }
            }
            if (filterStr != "")
            {
                filterStr = filterStr.Remove(filterStr.Length - 1, 1);
            }
            return(filterStr);
        }
コード例 #8
0
 //
 /// <summary>
 /// 初始化分组设计的字段,然后当前设计的字段引用到分组的Section 中
 /// </summary>
 /// <param name="pReport"></param>
 public static void IniGroupFieldOnOpen(DIYReport.ReportModel.RptReport pReport)
 {
     //判断是否有分组的Section
     DIYReport.ReportModel.RptSectionList sectionList = pReport.SectionList;
     foreach (DIYReport.ReportModel.RptSection section in sectionList)
     {
         if (section.SectionType == SectionType.GroupHead || section.SectionType == SectionType.GroupFooter)
         {
             DIYReport.GroupAndSort.RptFieldInfo groupField = section.GroupField;
             if (groupField == null)
             {
                 Debug.Assert(false, "在获取报表的分组Section 时,得到字段的信息为空。");
             }
             IList fieldList = pReport.DesignField;
             if (fieldList == null)
             {
                 Debug.Assert(false, "没有初始化设计的字段。");
             }
             int count = fieldList.Count;
             for (int i = 0; i < count; i++)
             {
                 DIYReport.GroupAndSort.RptFieldInfo designField = fieldList[i] as DIYReport.GroupAndSort.RptFieldInfo;
                 if (designField.FieldName.Trim().ToUpper() == groupField.FieldName.Trim().ToUpper())
                 {
                     designField.IsGroup     = true;
                     designField.IsAscending = groupField.IsAscending;
                     designField.OrderIndex  = groupField.OrderIndex;
                     designField.SetSort     = groupField.SetSort;
                     designField.DivideName  = groupField.DivideName;
                     section.GroupField      = designField;
                     break;
                 }
             }
         }
     }
 }