Pārlūkot izejas kodu

报告导出优化

zhangjiaxin 1 gadu atpakaļ
vecāks
revīzija
d2b6358098

+ 16 - 1
OTSIncAReportApp/1-UI/OTSTemplateDesigner/OTSReport_Export.cs

@@ -1576,7 +1576,11 @@ namespace OTSIncAReportApp
                     if (ls_str.IndexOf(table["element_analysis_table"].ToString()) > -1)//元素分析表
                     {
                         if (m_mbszclass.M_YSFXJG.b_ck_ysfx_xsmk)
+                        {
+                            DEVReport.XRPageBreak();
                             DEVReport.setElementAvgGrid();
+                        }
+                            //DEVReport.setElementAvgGrid();
                         lock (m_thread_flag)
                             m_thread_flag = strNill;
                     }
@@ -1584,7 +1588,11 @@ namespace OTSIncAReportApp
                     if (ls_str.IndexOf(table["inca_area_ratio_table"].ToString()) > -1)//夹杂物面积比表
                     {
                         if (m_mbszclass.M_JZWZB.b_ck_surface)
+                        {
+                            DEVReport.XRPageBreak();
                             DEVReport.setINCAtable();
+                        }
+                            
                         lock (m_thread_flag)
                             m_thread_flag = strNill;
                     }
@@ -1593,7 +1601,7 @@ namespace OTSIncAReportApp
                     {
                         if (m_mbszclass.M_JZWZB.b_ck_chart)
                         {
-                            //DEVReport.XRPageBreak();
+                            DEVReport.XRPageBreak();
                             DEVReport.set_incaPIC_classify();
                             DEVReport.set_incaPIC_subdivision();
                         }
@@ -1615,7 +1623,11 @@ namespace OTSIncAReportApp
                     if (ls_str.IndexOf(table["particle_list"].ToString()) > -1)//颗粒列表
                     {
                         if (m_mbszclass.M_KLLBXX.b_ck_kllb_xsmk)
+                        {
+                            DEVReport.XRPageBreak();
                             DEVReport.set_kllb_data();
+                        }
+                            
                         lock (m_thread_flag)
                             m_thread_flag = strNill;
                     }
@@ -1623,7 +1635,10 @@ namespace OTSIncAReportApp
                     if (ls_str.IndexOf(table["particle_list_frame_diagram"].ToString()) > -1)//颗粒帧图列表
                     {
                         if (m_mbszclass.M_KLLBXX.b_ck_kllb_fjzt)
+                        {
+                            DEVReport.XRPageBreak();
                             DEVReport.set_kllb_data_frame();
+                        }
                         
                         lock (m_thread_flag)
                             m_thread_flag = strNill;

+ 4 - 35
OTSIncAReportApp/ReportTemplate/OTS_DEVReport.Designer.cs

@@ -99,7 +99,6 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             this.xrChart_incaSubdivision = new DevExpress.XtraReports.UI.XRChart();
             this.xrLabel_inca_pic_class = new DevExpress.XtraReports.UI.XRLabel();
             this.xrChart_incaClass = new DevExpress.XtraReports.UI.XRChart();
-            this.xrPageBreak5 = new DevExpress.XtraReports.UI.XRPageBreak();
             this.xr_tbAreaOfInclusion = new DevExpress.XtraReports.UI.XRTable();
             this.xrTableRow12 = new DevExpress.XtraReports.UI.XRTableRow();
             this.xrCellAreaOfInclusion = new DevExpress.XtraReports.UI.XRTableCell();
@@ -109,7 +108,6 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             this.xrCell_inclusion_Area = new DevExpress.XtraReports.UI.XRTableCell();
             this.xrCell_inclusion_percentageOfIncA = new DevExpress.XtraReports.UI.XRTableCell();
             this.xrCell_inclusion_FieldRatio = new DevExpress.XtraReports.UI.XRTableCell();
-            this.xrPageBreak4 = new DevExpress.XtraReports.UI.XRPageBreak();
             this.xrTb_ElementAnalysisTable = new DevExpress.XtraReports.UI.XRTable();
             this.xrTableRow15 = new DevExpress.XtraReports.UI.XRTableRow();
             this.xrCellElementArea = new DevExpress.XtraReports.UI.XRTableCell();
@@ -129,10 +127,8 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             this.xrCell_Element_s8 = new DevExpress.XtraReports.UI.XRTableCell();
             this.xrCell_Element_s9 = new DevExpress.XtraReports.UI.XRTableCell();
             this.xrCell_Element_s10 = new DevExpress.XtraReports.UI.XRTableCell();
-            this.xrPageBreak3 = new DevExpress.XtraReports.UI.XRPageBreak();
             this.xrLabel_size_IconQuestion_Class = new DevExpress.XtraReports.UI.XRLabel();
             this.xrChart_ParticelSizeCalss = new DevExpress.XtraReports.UI.XRChart();
-            this.xrPageBreak2 = new DevExpress.XtraReports.UI.XRPageBreak();
             this.xrTa_ParticleSizeTable = new DevExpress.XtraReports.UI.XRTable();
             this.xrTableRow8 = new DevExpress.XtraReports.UI.XRTableRow();
             this.dev_DimensionTable = new DevExpress.XtraReports.UI.XRTableCell();
@@ -278,14 +274,10 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             this.xrChart_incaSubdivision,
             this.xrLabel_inca_pic_class,
             this.xrChart_incaClass,
-            this.xrPageBreak5,
             this.xr_tbAreaOfInclusion,
-            this.xrPageBreak4,
             this.xrTb_ElementAnalysisTable,
-            this.xrPageBreak3,
             this.xrLabel_size_IconQuestion_Class,
             this.xrChart_ParticelSizeCalss,
-            this.xrPageBreak2,
             this.xrTa_ParticleSizeTable,
             this.xrTable1,
             this.xrPageBreak1,
@@ -453,7 +445,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             this.xrChart_ParticelSizeSubdivision.BorderColor = System.Drawing.Color.Black;
             this.xrChart_ParticelSizeSubdivision.Borders = DevExpress.XtraPrinting.BorderSide.None;
             this.xrChart_ParticelSizeSubdivision.Legend.Name = "Default Legend";
-            this.xrChart_ParticelSizeSubdivision.LocationFloat = new DevExpress.Utils.PointFloat(30.41611F, 2182.292F);
+            this.xrChart_ParticelSizeSubdivision.LocationFloat = new DevExpress.Utils.PointFloat(30.41687F, 2182.292F);
             this.xrChart_ParticelSizeSubdivision.Name = "xrChart_ParticelSizeSubdivision";
             this.xrChart_ParticelSizeSubdivision.PaletteName = "Palette 1";
             this.xrChart_ParticelSizeSubdivision.PaletteRepository.Add("Palette 1", new DevExpress.XtraCharts.Palette("Palette 1", DevExpress.XtraCharts.PaletteScaleMode.Repeat, new DevExpress.XtraCharts.PaletteEntry[] {
@@ -898,7 +890,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             this.xrChart_incaSubdivision.BorderColor = System.Drawing.Color.Black;
             this.xrChart_incaSubdivision.Borders = DevExpress.XtraPrinting.BorderSide.None;
             this.xrChart_incaSubdivision.Legend.Name = "Default Legend";
-            this.xrChart_incaSubdivision.LocationFloat = new DevExpress.Utils.PointFloat(30.41636F, 3380.528F);
+            this.xrChart_incaSubdivision.LocationFloat = new DevExpress.Utils.PointFloat(30.41611F, 3380.528F);
             this.xrChart_incaSubdivision.Name = "xrChart_incaSubdivision";
             this.xrChart_incaSubdivision.SeriesSerializable = new DevExpress.XtraCharts.Series[0];
             this.xrChart_incaSubdivision.SizeF = new System.Drawing.SizeF(630F, 478.33F);
@@ -923,17 +915,12 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             this.xrChart_incaClass.BorderColor = System.Drawing.Color.Black;
             this.xrChart_incaClass.Borders = DevExpress.XtraPrinting.BorderSide.None;
             this.xrChart_incaClass.Legend.Name = "Default Legend";
-            this.xrChart_incaClass.LocationFloat = new DevExpress.Utils.PointFloat(30.41636F, 2957.528F);
+            this.xrChart_incaClass.LocationFloat = new DevExpress.Utils.PointFloat(30.41687F, 2957.528F);
             this.xrChart_incaClass.Name = "xrChart_incaClass";
             this.xrChart_incaClass.SeriesSerializable = new DevExpress.XtraCharts.Series[0];
             this.xrChart_incaClass.SizeF = new System.Drawing.SizeF(630F, 400F);
             this.xrChart_incaClass.Visible = false;
             // 
-            // xrPageBreak5
-            // 
-            this.xrPageBreak5.LocationFloat = new DevExpress.Utils.PointFloat(0F, 2913.458F);
-            this.xrPageBreak5.Name = "xrPageBreak5";
-            // 
             // xr_tbAreaOfInclusion
             // 
             this.xr_tbAreaOfInclusion.Borders = ((DevExpress.XtraPrinting.BorderSide)((((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Top) 
@@ -1017,11 +1004,6 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             this.xrCell_inclusion_FieldRatio.Text = "xrCell_inclusion_FieldRatio";
             this.xrCell_inclusion_FieldRatio.Weight = 1D;
             // 
-            // xrPageBreak4
-            // 
-            this.xrPageBreak4.LocationFloat = new DevExpress.Utils.PointFloat(0F, 2844.707F);
-            this.xrPageBreak4.Name = "xrPageBreak4";
-            // 
             // xrTb_ElementAnalysisTable
             // 
             this.xrTb_ElementAnalysisTable.Borders = ((DevExpress.XtraPrinting.BorderSide)((((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Top) 
@@ -1186,11 +1168,6 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             this.xrCell_Element_s10.Text = "xrCell_Element_s10";
             this.xrCell_Element_s10.Weight = 0.94476737532504773D;
             // 
-            // xrPageBreak3
-            // 
-            this.xrPageBreak3.LocationFloat = new DevExpress.Utils.PointFloat(0F, 2673.875F);
-            this.xrPageBreak3.Name = "xrPageBreak3";
-            // 
             // xrLabel_size_IconQuestion_Class
             // 
             this.xrLabel_size_IconQuestion_Class.BackColor = System.Drawing.Color.DarkGray;
@@ -1216,11 +1193,6 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             this.xrChart_ParticelSizeCalss.SizeF = new System.Drawing.SizeF(630F, 400F);
             this.xrChart_ParticelSizeCalss.Visible = false;
             // 
-            // xrPageBreak2
-            // 
-            this.xrPageBreak2.LocationFloat = new DevExpress.Utils.PointFloat(0F, 1721.792F);
-            this.xrPageBreak2.Name = "xrPageBreak2";
-            // 
             // xrTa_ParticleSizeTable
             // 
             this.xrTa_ParticleSizeTable.Borders = ((DevExpress.XtraPrinting.BorderSide)((((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Top) 
@@ -1678,6 +1650,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             // 
             this.xrPageBreak1.LocationFloat = new DevExpress.Utils.PointFloat(0F, 930.6249F);
             this.xrPageBreak1.Name = "xrPageBreak1";
+            this.xrPageBreak1.Visible = false;
             // 
             // dev_ckbz_text_up
             // 
@@ -1909,11 +1882,9 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         private DevExpress.XtraReports.UI.XRTableCell dev_size_6;
         private DevExpress.XtraReports.UI.XRTableCell dev_size_7;
         private DevExpress.XtraReports.UI.XRChart xrChart_ParticelSizeSubdivision;
-        private DevExpress.XtraReports.UI.XRPageBreak xrPageBreak2;
         private DevExpress.XtraReports.UI.XRChart xrChart_ParticelSizeCalss;
         private DevExpress.XtraReports.UI.XRLabel xrLabel_size_IconQuestion_Subdivision;
         private DevExpress.XtraReports.UI.XRLabel xrLabel_size_IconQuestion_Class;
-        private DevExpress.XtraReports.UI.XRPageBreak xrPageBreak3;
         private DevExpress.XtraReports.UI.XRTable xrTb_ElementAnalysisTable;
         private DevExpress.XtraReports.UI.XRTableRow xrTableRow14;
         private DevExpress.XtraReports.UI.XRTableCell xrCell_Element_classify;
@@ -1933,7 +1904,6 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         private DevExpress.XtraReports.UI.XRTableCell xrCellElementArea;
         private DevExpress.XtraReports.UI.XRTableRow xrTableRow11;
         private DevExpress.XtraReports.UI.XRTableCell xrCellElementArea_details;
-        private DevExpress.XtraReports.UI.XRPageBreak xrPageBreak4;
         private DevExpress.XtraReports.UI.XRTable xr_tbAreaOfInclusion;
         private DevExpress.XtraReports.UI.XRTableRow xrTableRow12;
         private DevExpress.XtraReports.UI.XRTableCell xrCellAreaOfInclusion;
@@ -1944,7 +1914,6 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         private DevExpress.XtraReports.UI.XRTableCell xrCell_inclusion_percentageOfIncA;
         private DevExpress.XtraReports.UI.XRTableCell xrCell_inclusion_FieldRatio;
         private DevExpress.XtraReports.UI.XRChart xrChart_incaClass;
-        private DevExpress.XtraReports.UI.XRPageBreak xrPageBreak5;
         private DevExpress.XtraReports.UI.XRLabel xrLabel_inca_pic_subdivision;
         private DevExpress.XtraReports.UI.XRChart xrChart_incaSubdivision;
         private DevExpress.XtraReports.UI.XRLabel xrLabel_inca_pic_class;

+ 146 - 127
OTSIncAReportApp/ReportTemplate/OTS_DEVReport.cs

@@ -54,6 +54,8 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
                 }
             }
             InitializeComponent();
+
+         
         }
         #region 接口
         /// <summary>
@@ -128,6 +130,9 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         /// <param name="TemplateClass"></param>
         public void setResultGrid()
         {
+
+            xrChart_ParticelSizeCalss.Visible = false;
+            xrChart_ParticelSizeSubdivision.Visible = false;
             #region 从Grid表中读取样品数据
             //------------------加载模块,获取数据-------------------------------------------------
             ResultGrid ls_resultgrid = new ResultGrid(m_otsreport_export.m_ReportApp);
@@ -149,7 +154,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             setTableCellData(dev_sczs_text, str_SCZS);//视场总数
             setTableCellData(dev_flfa_text, str_FLFA);//分类方案
             setTableCellData(dev_yjctz_text, str_YJCTZ);//已检测特征
-            setTableCellData(dev_scmj_text, str_SCMJ+ "μm²");//视场面积
+            setTableCellData(dev_scmj_text, str_SCMJ + "μm²");//视场面积
             setTableCellData(dev_fdbs_text, Magnification);//放大倍数
             setTableCellData(dev_bgsj_text, DateTime.Now.ToShortDateString().ToString());//报告时间:
             setTableCellData(dev_ckbz_text, TemplateClass.M_SY.str_tb_CKBZ.ToString());//参考标准
@@ -172,14 +177,15 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         /// </summary>
         /// <param name="a_pieSeriesClass">大分类</param>
         /// <param name="a_pieSeries">小分类</param>
-        public void setParticleSizeTable(bool a_pieSeriesClass,bool a_pieSeries,bool isStacking)
+        public void setParticleSizeTable(bool a_pieSeriesClass, bool a_pieSeries, bool isStacking)
         {
-            export_ReportTemplate.ParticleSizeTable(TemplateClass, out DataTable surface_dt, out DataTable ls_partsize_dt, out DataTable class_dt, out DataTable subdivde_dt,out DataTable colid_data);
-            for (int i=0;i< class_dt.Rows.Count;i++)
+            xrPageBreak1.Visible = true;
+            export_ReportTemplate.ParticleSizeTable(TemplateClass, out DataTable surface_dt, out DataTable ls_partsize_dt, out DataTable class_dt, out DataTable subdivde_dt, out DataTable colid_data);
+            for (int i = 0; i < class_dt.Rows.Count; i++)
             {
                 class_dt.Rows[i]["Class"] = subscript.Getsubscriptstring(class_dt.Rows[i]["Class"].ToString());
             }
-            for (int i=0;i< subdivde_dt.Rows.Count;i++)
+            for (int i = 0; i < subdivde_dt.Rows.Count; i++)
             {
                 subdivde_dt.Rows[i]["Name"] = subscript.Getsubscriptstring(subdivde_dt.Rows[i]["Name"].ToString());
                 subdivde_dt.Rows[i]["Class"] = subscript.Getsubscriptstring(subdivde_dt.Rows[i]["Class"].ToString());
@@ -191,7 +197,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             List<List<ParticleSizeDEVData>> list_ParticelSizeData = new List<List<ParticleSizeDEVData>>();
             for (int i = 0; i < surface_dt.Rows.Count; i++)
             {
-                list_ParticelSizeData.Add(switch_ParticleSize(subscript.Getsubscriptstring(surface_dt.Rows[i]["Class"].ToString()) , subscript.Getsubscriptstring(surface_dt.Rows[i]["Name"].ToString()), surface_dt.Rows[i]["total"].ToString(), surface_dt.Rows[i]["c1"].ToString(), surface_dt.Rows[i]["c2"].ToString(), surface_dt.Rows[i]["c3"].ToString(),
+                list_ParticelSizeData.Add(switch_ParticleSize(subscript.Getsubscriptstring(surface_dt.Rows[i]["Class"].ToString()), subscript.Getsubscriptstring(surface_dt.Rows[i]["Name"].ToString()), surface_dt.Rows[i]["total"].ToString(), surface_dt.Rows[i]["c1"].ToString(), surface_dt.Rows[i]["c2"].ToString(), surface_dt.Rows[i]["c3"].ToString(),
                     surface_dt.Rows[i]["c4"].ToString(), surface_dt.Rows[i]["c5"].ToString(), surface_dt.Rows[i]["c6"].ToString(), surface_dt.Rows[i]["c7"].ToString()));
             }
             //dev_classify.Text = "分类";
@@ -225,7 +231,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
                 XRTableCell tCell_size_7 = new XRTableCell();
 
                 tCell_Class.WidthF = xrTa_ParticleSizeTable.Rows[2].Cells[0].WidthF;
-                tCell_Name.WidthF= xrTa_ParticleSizeTable.Rows[2].Cells[1].WidthF;
+                tCell_Name.WidthF = xrTa_ParticleSizeTable.Rows[2].Cells[1].WidthF;
                 tCell_total.WidthF = xrTa_ParticleSizeTable.Rows[2].Cells[2].WidthF;
                 tCell_size_1.WidthF = xrTa_ParticleSizeTable.Rows[2].Cells[3].WidthF;
                 tCell_size_2.WidthF = xrTa_ParticleSizeTable.Rows[2].Cells[4].WidthF;
@@ -278,7 +284,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
                 }
                 total += Convert.ToInt32(surface_dt2.Rows[i]["total"]);
             }
-            
+
             xtParticleResultsB.Text = total.ToString();
             xtParticleResultsB.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
             xtParticleResultsC.Text = vs[0].ToString();
@@ -295,16 +301,27 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             xtParticleResultsH.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
             xtParticleResultsI.Text = vs[6].ToString();
             xtParticleResultsI.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
+            NeueStartposition = xrTable3.LocationF.Y + xrTable3.SizeF.Height+1;
             if (isStacking)
             {
                 xrChart1.Visible = true;
                 HistogramChart();
             }
-                
+
+            if (a_pieSeriesClass || a_pieSeries)
+            {
+                //NeueStartposition = xrChart1.LocationF.Y + xrChart1.SizeF.Height + 20;
+                XRPageBreak();
+                //xrPageBreak2.Visible = false;
+            }
+            xrChart_ParticelSizeCalss.Visible = false;
             #region 大分类chart图
             if (a_pieSeriesClass)
             {
+                xrChart_ParticelSizeCalss.Visible = true;
                 xrLabel_size_IconQuestion_Class.Visible = true;
+                xrLabel_size_IconQuestion_Class.LocationF = new PointF(xrLabel_size_IconQuestion_Class.LocationF.X, NeueStartposition);
+                NeueStartposition = xrLabel_size_IconQuestion_Class.LocationF.Y + xrLabel_size_IconQuestion_Class.SizeF.Height + 10;
                 DataView dv = class_dt.DefaultView;
                 dv.Sort = "total DESC";
                 DataTable dt_class_dt = dv.ToTable();
@@ -331,20 +348,25 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
                 this.xrChart_ParticelSizeCalss.Legend.TextOffset = 5;
                 this.xrChart_ParticelSizeCalss.Legend.VerticalIndent = 5;
                 this.xrChart_ParticelSizeCalss.Legend.Border.Color = Color.Red;//红色边框
+                xrChart_ParticelSizeCalss.LocationF = new PointF(30f, NeueStartposition);
+                NeueStartposition = xrChart_ParticelSizeCalss.LocationF.Y + xrChart_ParticelSizeCalss.SizeF.Height+1 ;
             }
             #endregion
             #region 细分chart图
-            if(a_pieSeries)
+            xrChart_ParticelSizeSubdivision.Visible = false;
+            if (a_pieSeries)
             {
-                if (!a_pieSeriesClass)
-                {
+                //if (!a_pieSeriesClass)
+                //{
 
-                    xrChart_ParticelSizeSubdivision.LocationF = xrChart_ParticelSizeCalss.LocationF;
-                    xrLabel_size_IconQuestion_Subdivision.LocationF = xrLabel_size_IconQuestion_Class.LocationF;
-                    
-                }
+                //    xrChart_ParticelSizeSubdivision.LocationF = xrChart_ParticelSizeCalss.LocationF;
+                //    xrLabel_size_IconQuestion_Subdivision.LocationF = xrLabel_size_IconQuestion_Class.LocationF;
 
+                //}
+                xrChart_ParticelSizeSubdivision.Visible = true;
                 xrLabel_size_IconQuestion_Subdivision.Visible = true;
+                xrLabel_size_IconQuestion_Subdivision.LocationF = new PointF(xrLabel_size_IconQuestion_Subdivision.LocationF.X, NeueStartposition);
+                NeueStartposition = xrLabel_size_IconQuestion_Subdivision.LocationF.Y + xrLabel_size_IconQuestion_Subdivision.SizeF.Height + 1;
                 DataView dv2 = subdivde_dt.DefaultView;
                 dv2.Sort = "total DESC";
                 DataTable dt_subdivde_dt = dv2.ToTable();
@@ -371,10 +393,15 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
                 this.xrChart_ParticelSizeSubdivision.Legend.TextOffset = 5;
                 this.xrChart_ParticelSizeSubdivision.Legend.VerticalIndent = 5;
                 this.xrChart_ParticelSizeSubdivision.Legend.Border.Color = Color.Red;//红色边框
+
+                xrChart_ParticelSizeSubdivision.LocationF = new PointF(30f, NeueStartposition);
+                NeueStartposition = xrChart_ParticelSizeSubdivision.LocationF.Y + xrChart_ParticelSizeSubdivision.SizeF.Height + 10;
             }
-          
+
             #endregion
             #endregion
+            //xrPageBreak3.LocationF = new PointF(xrPageBreak3.LocationF.X, NeueStartposition);
+            //NeueStartposition = xrPageBreak3.LocationF.Y + xrPageBreak3.SizeF.Height + 10;
         }
 
         public void HistogramChart()
@@ -431,7 +458,8 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             ((XYDiagram)xrChart1.Diagram).AxisX.Title.Font = new Font("Tahoma", 9);
             ((XYDiagram)xrChart1.Diagram).AxisY.Title.Alignment = StringAlignment.Far;
             ((XYDiagram)xrChart1.Diagram).AxisX.Title.Alignment = StringAlignment.Far;
-
+            xrChart1.LocationF = new PointF(xrChart1.LocationF.X, NeueStartposition);
+            NeueStartposition = xrChart1.LocationF.Y + xrChart1.SizeF.Height + 20;
         }
         /// <summary>
         /// 设置插入元素分析表数据
@@ -440,8 +468,13 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         public void setElementAvgGrid()
         {
             xrTb_ElementAnalysisTable.Visible = true;
+            //xrTb_ElementAnalysisTable.LocationF = new PointF(xrTb_ElementAnalysisTable.LocationF.X, NeueStartposition);
+            //NeueStartposition = xrTb_ElementAnalysisTable.LocationF.Y + xrTb_ElementAnalysisTable.SizeF.Height + 10;
+            //xrPageBreak3.Visible = true;
+            //xrPageBreak3.LocationF = new PointF(0f, NeueStartposition);
+            //NeueStartposition = xrPageBreak3.LocationF.Y + 2;
 
-            export_ReportTemplate.InsertReportTemplateTable_ElementAvgGrid(TemplateClass, out DataTable dt1, out DataTable dt2,out DataTable allElement_dt);
+            export_ReportTemplate.InsertReportTemplateTable_ElementAvgGrid(TemplateClass, out DataTable dt1, out DataTable dt2, out DataTable allElement_dt);
             setXRLabelData(xrCell_Element_s1, dt1.Rows[0][2].ToString());
             setXRLabelData(xrCell_Element_s2, dt1.Rows[0][3].ToString());
             setXRLabelData(xrCell_Element_s3, dt1.Rows[0][4].ToString());
@@ -457,9 +490,9 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             for (int i = 0; i < dt2.Rows.Count; i++)
             {
                 double quantity = 0;
-                for (int a=2;a<12;a++)
+                for (int a = 2; a < 12; a++)
                 {
-                    if (dt2.Rows[i][a].ToString()!="")
+                    if (dt2.Rows[i][a].ToString() != "")
                     {
                         //int number=0;
                         if (double.TryParse(dt2.Rows[i][a].ToString(), out double number))
@@ -525,18 +558,19 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
                 xrTb_ElementAnalysisTable.Rows.Add(row);
             }
 
-
+            xrTb_ElementAnalysisTable.LocationF = new PointF(xrTb_ElementAnalysisTable.LocationF.X, NeueStartposition);
+            NeueStartposition = xrTb_ElementAnalysisTable.LocationF.Y + xrTb_ElementAnalysisTable.SizeF.Height + 10;
 
 
 
             xrTb_ElementAnalysis.Visible = true;
             //xrPageBreak6.Visible = true;
-            for (int i=0;i< allElement_dt.Rows.Count;i++)
+            for (int i = 0; i < allElement_dt.Rows.Count; i++)
             {
                 double quantity = 0;
                 for (int a = 4; a < allElement_dt.Columns.Count; a++)
                 {
-                    if(allElement_dt.Rows[i][a].ToString()!="")
+                    if (allElement_dt.Rows[i][a].ToString() != "")
                     {
                         quantity = quantity + Convert.ToDouble(allElement_dt.Rows[i][a].ToString());
 
@@ -544,20 +578,24 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
                 }
 
 
-                    string str_data = "";
-                for (int a=4;a< allElement_dt.Columns.Count;a++)
+                string str_data = "";
+                for (int a = 4; a < allElement_dt.Columns.Count; a++)
                 {
-                    if (allElement_dt.Rows[i][a].ToString()!="")
+                    if (allElement_dt.Rows[i][a].ToString() != "")
                     {
                         str_data = str_data + allElement_dt.Columns[a].ColumnName.ToString() + "=" + export_ReportTemplate.ParameterNormalization(quantity, Convert.ToDouble(allElement_dt.Rows[i][a].ToString())) + "%" + "  ";
                     }
                 }
                 xrTb_ElementAnalysis.Rows.Add(addElementalAnalysisRows(allElement_dt.Rows[i]["Name"].ToString(), str_data));
             }
-           
+
+            xrTb_ElementAnalysis.LocationF = new PointF(xrTb_ElementAnalysis.LocationF.X, NeueStartposition);
+            NeueStartposition = xrTb_ElementAnalysis.LocationF.Y + xrTb_ElementAnalysis.SizeF.Height + 10;
+            //xrPageBreak4.LocationF = new PointF(xrPageBreak4.LocationF.X, NeueStartposition);
+            //NeueStartposition = xrPageBreak4.LocationF.Y + xrPageBreak4.SizeF.Height + 10;
         }
 
-        private XRTableRow addElementalAnalysisRows(string className,string data)
+        private XRTableRow addElementalAnalysisRows(string className, string data)
         {
             XRTableRow row = new XRTableRow();
             XRTableCell tCell_class = new XRTableCell();
@@ -576,13 +614,15 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         /// <param name="TemplateClass"></param>
         public void setINCAtable()
         {
-           
+            //xrPageBreak4.Visible = false;
+            //xrPageBreak4.LocationF = new PointF(0f, NeueStartposition);
+            //NeueStartposition = xrPageBreak4.LocationF.Y + 2;
             export_ReportTemplate.GenerateINCAtable(FieldOfViewArea, out DataTable dt);
             xr_tbAreaOfInclusion.Visible = true;
             List<List<AreaOfInclusionDEVData>> list_AreaOfInclusion = new List<List<AreaOfInclusionDEVData>>();
             for (int i = 0; i < dt.Rows.Count; i++)
             {
-                list_AreaOfInclusion.Add(set_AreaOfInclusion(subscript.Getsubscriptstring(dt.Rows[i]["Class"].ToString()) , subscript.Getsubscriptstring(dt.Rows[i]["subdivision"].ToString()), dt.Rows[i]["Area"].ToString(), dt.Rows[i]["inca_proportion"].ToString(),
+                list_AreaOfInclusion.Add(set_AreaOfInclusion(subscript.Getsubscriptstring(dt.Rows[i]["Class"].ToString()), subscript.Getsubscriptstring(dt.Rows[i]["subdivision"].ToString()), dt.Rows[i]["Area"].ToString(), dt.Rows[i]["inca_proportion"].ToString(),
                     dt.Rows[i]["inca_FieldRatio"].ToString()));
             }
             for (int i = 0; i < dt.Rows.Count; i++)
@@ -600,17 +640,19 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
                 XRTableCellData_AreaOfInclusion(row, tCell_inca_FieldRatio, Schriftart_english, DevExpress.XtraPrinting.TextAlignment.MiddleCenter, "Text", list_AreaOfInclusion[i], "inca_FieldRatio");
                 xr_tbAreaOfInclusion.Rows.Add(row);
             }
-
-
-            NeueStartposition = NeueStartposition + xr_tbAreaOfInclusion.SizeF.Height + 20;
+            xr_tbAreaOfInclusion.LocationF = new PointF(xr_tbAreaOfInclusion.LocationF.X, NeueStartposition);
+            NeueStartposition = xr_tbAreaOfInclusion.LocationF.Y + xr_tbAreaOfInclusion.SizeF.Height ;
+            //xrPageBreak5.LocationF = new PointF(0, NeueStartposition);
+            //NeueStartposition = xrPageBreak5.LocationF.Y + xrPageBreak5.SizeF.Height;
         }
         public void XRPageBreak()
         {
 
             XRPageBreak xRPage = new XRPageBreak();
             xRPage.Name = "kllb_Page";
-            xRPage.LocationF = new PointF(0, NeueStartposition + 2);
+            xRPage.LocationF = new PointF(0, NeueStartposition);
             this.Detail.Controls.Add(xRPage);
+            NeueStartposition = xRPage.LocationF.Y + xRPage.HeightF + 1;
         }
         /// <summary>
         /// 设置插入夹杂物面积比图像
@@ -618,16 +660,15 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         /// <param name="TemplateClass"></param>
         public void set_incaPIC_classify()
         {
-            xrChart_incaClass.Visible = true;
             xrLabel_inca_pic_class.Visible = true;
+            xrLabel_inca_pic_class.LocationF = new PointF(xrLabel_inca_pic_class.LocationF.X, NeueStartposition);
+            NeueStartposition = xrLabel_inca_pic_class.LocationF.Y + xrLabel_inca_pic_class.SizeF.Height + 1;
 
-            //xrLabel_inca_pic_class.LocationF= new PointF(0, NeueStartposition + 2);
-            //xrChart_incaClass.LocationF = new PointF(0, NeueStartposition + 2);
             DataTable data = export_ReportTemplate.ClassificationIntegration(TemplateClass, dev_sczs_text.Text);
 
-            for (int i=0;i<data.Rows.Count;i++)
+            for (int i = 0; i < data.Rows.Count; i++)
             {
-                if (data.Rows[i]["Class"].ToString()== "Other")
+                if (data.Rows[i]["Class"].ToString() == "Other")
                 {
                     data.Rows[i].Delete();
                 }
@@ -639,7 +680,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             DataTable dt_data = dv.ToTable();
 
 
-            for (int i=0;i< dt_data.Rows.Count;i++)
+            for (int i = 0; i < dt_data.Rows.Count; i++)
             {
                 dt_data.Rows[i]["Class"] = subscript.Getsubscriptstring(dt_data.Rows[i]["Class"].ToString());
             }
@@ -666,22 +707,27 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             this.xrChart_incaClass.Legend.VerticalIndent = 5;
             this.xrChart_incaClass.Legend.Border.Color = Color.Red;//红色边框
 
-            NeueStartposition = xrChart_incaClass.LocationF.Y + xrChart_incaClass.Height+5;
+
+            xrChart_incaClass.Visible = true;
+            xrChart_incaClass.LocationF = new PointF(30f, NeueStartposition);
+            NeueStartposition = xrChart_incaClass.LocationF.Y + xrChart_incaClass.SizeF.Height + 1;
+
+            //NeueStartposition = xrChart_incaClass.LocationF.Y + xrChart_incaClass.Height+5;
         }
         public void set_incaPIC_subdivision()
         {
             xrChart_incaSubdivision.Visible = true;
             xrLabel_inca_pic_subdivision.Visible = true;
 
-            xrLabel_inca_pic_subdivision.LocationF = new PointF(xrLabel_inca_pic_subdivision.LocationF.X, NeueStartposition + 2);
-            NeueStartposition = xrLabel_inca_pic_subdivision.LocationF.Y + xrLabel_inca_pic_subdivision.Height + 2;
-            xrChart_incaSubdivision.LocationF = new PointF(xrChart_incaSubdivision.LocationF.X, NeueStartposition + 2);
-            NeueStartposition = xrChart_incaSubdivision.LocationF.Y + xrChart_incaSubdivision.Height + 2;
+
+            xrLabel_inca_pic_subdivision.LocationF = new PointF(xrLabel_inca_pic_subdivision.LocationF.X, NeueStartposition);
+            NeueStartposition = xrLabel_inca_pic_subdivision.LocationF.Y + xrLabel_inca_pic_subdivision.Height + 1;
+
             DataTable data = export_ReportTemplate.subdivisionIntegration(TemplateClass);
 
-            for (int i=0;i<data.Rows.Count;i++)
+            for (int i = 0; i < data.Rows.Count; i++)
             {
-                if (data.Rows[i]["TypeName"].ToString()== "Not Identified")
+                if (data.Rows[i]["TypeName"].ToString() == "Not Identified")
                 {
                     data.Rows[i].Delete();
                 }
@@ -692,7 +738,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             dv.Sort = "con DESC";
             DataTable dt_data = dv.ToTable();
 
-            for (int i=0;i< dt_data.Rows.Count;i++)
+            for (int i = 0; i < dt_data.Rows.Count; i++)
             {
                 dt_data.Rows[i]["TypeName"] = subscript.Getsubscriptstring(dt_data.Rows[i]["TypeName"].ToString());
                 dt_data.Rows[i]["GroupName"] = subscript.Getsubscriptstring(dt_data.Rows[i]["GroupName"].ToString());
@@ -719,6 +765,9 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             this.xrChart_incaSubdivision.Legend.TextOffset = 5;
             this.xrChart_incaSubdivision.Legend.VerticalIndent = 5;
             this.xrChart_incaSubdivision.Legend.Border.Color = Color.Red;//红色边框
+
+            xrChart_incaSubdivision.LocationF = new PointF(30f, NeueStartposition);
+            NeueStartposition = xrChart_incaSubdivision.LocationF.Y + xrChart_incaSubdivision.Height + 1;
         }
 
         public static Color FromHex(string hex)
@@ -728,7 +777,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             byte r = Convert.ToByte(hex.Substring(0, 2), 16);
             byte g = Convert.ToByte(hex.Substring(2, 2), 16);
             byte b = Convert.ToByte(hex.Substring(4, 2), 16);
-            return Color.FromArgb(a, r, g, b);          
+            return Color.FromArgb(a, r, g, b);
         }
         /// <summary>
         /// 三元图
@@ -760,66 +809,38 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             Color_list.Add(FromHex("#34ADAE"));
             Color_list.Add(FromHex("#3DDFD2"));
             Color_list.Add(FromHex("#A0FFFF"));
-     
-            //Color_list.Add(Color.FromArgb(238, 175, 14));
-            //Color_list.Add(Color.FromArgb(0, 0, 238));
-            //Color_list.Add(Color.FromArgb(0, 205, 0));
-            //Color_list.Add(Color.FromArgb(238, 0, 0));
-            //Color_list.Add(Color.FromArgb(153, 50, 204));
-            //Color_list.Add(Color.FromArgb(255, 102, 153));
-            //Color_list.Add(Color.FromArgb(160, 82, 45));
-            //Color_list.Add(Color.FromArgb(181, 181, 181));
-            //Color_list.Add(Color.FromArgb(250, 235, 215));
-            //Color_list.Add(Color.FromArgb(238, 130, 238));
-            //Color_list.Add(Color.FromArgb(174, 238, 238));
-            //Color_list.Add(Color.FromArgb(247, 172, 189));
-            //Color_list.Add(Color.FromArgb(202, 134, 135));
-            //Color_list.Add(Color.FromArgb(34, 90, 31));
-
-            //Color_list.Add(Color.FromArgb(238, 175, 14));
-            //Color_list.Add(Color.FromArgb(0, 0, 238));
-            //Color_list.Add(Color.FromArgb(0, 205, 0));
-            //Color_list.Add(Color.FromArgb(238, 0, 0));
-            //Color_list.Add(Color.FromArgb(153, 50, 204));
-            //Color_list.Add(Color.FromArgb(255, 102, 153));
-            //Color_list.Add(Color.FromArgb(160, 82, 45));
-            //Color_list.Add(Color.FromArgb(181, 181, 181));
-            //Color_list.Add(Color.FromArgb(250, 235, 215));
-            //Color_list.Add(Color.FromArgb(238, 130, 238));
-            //Color_list.Add(Color.FromArgb(174, 238, 238));
-            //Color_list.Add(Color.FromArgb(247, 172, 189));
-            //Color_list.Add(Color.FromArgb(202, 134, 135));
-            //Color_list.Add(Color.FromArgb(34, 90, 31));
-
-
-            for (int i = 0; i < TemplateClass.M_SYXT.list_lbv_syxt_mblb_index.Count; i=i+4)
+            //XRPageBreak xRPage2 = new XRPageBreak();
+            //xRPage2.LocationF = new PointF(0, NeueStartposition);
+
+            //this.Detail.Controls.Add(xRPage2);
+            //NeueStartposition = xRPage2.LocationF.Y + 20;
+            for (int i = 0; i < TemplateClass.M_SYXT.list_lbv_syxt_mblb_index.Count; i = i + 4)
             {
 
-                set_syt_pic_legend(Color_list);
+                var xRPicture = set_syt_pic_legend(Color_list, i);
 
-                if (i< TemplateClass.M_SYXT.list_lbv_syxt_mblb_index.Count)
+                if (i < TemplateClass.M_SYXT.list_lbv_syxt_mblb_index.Count)
                 {
-                    set_syt_pic(TemplateClass, TemplateClass.M_SYXT.list_lbv_syxt_mblb_index[i], Color_list, new PointF(10f, NeueStartposition + 2));
+                    set_syt_pic(TemplateClass, TemplateClass.M_SYXT.list_lbv_syxt_mblb_index[i], Color_list, new PointF(10f, NeueStartposition));
                 }
-                if (i+1 < TemplateClass.M_SYXT.list_lbv_syxt_mblb_index.Count)
+                if (i + 1 < TemplateClass.M_SYXT.list_lbv_syxt_mblb_index.Count)
                 {
-                    set_syt_pic(TemplateClass, TemplateClass.M_SYXT.list_lbv_syxt_mblb_index[i+1], Color_list, new PointF(343.8f, NeueStartposition + 2));
+                    set_syt_pic(TemplateClass, TemplateClass.M_SYXT.list_lbv_syxt_mblb_index[i + 1], Color_list, new PointF(343.8f, NeueStartposition));
                 }
 
-                if (i+2 < TemplateClass.M_SYXT.list_lbv_syxt_mblb_index.Count)
+                if (i + 2 < TemplateClass.M_SYXT.list_lbv_syxt_mblb_index.Count)
                 {
-                    set_syt_pic(TemplateClass, TemplateClass.M_SYXT.list_lbv_syxt_mblb_index[i+2], Color_list, new PointF(10f, NeueStartposition + 345+5));
+                    set_syt_pic(TemplateClass, TemplateClass.M_SYXT.list_lbv_syxt_mblb_index[i + 2], Color_list, new PointF(10f, NeueStartposition + 345));
                 }
                 if (i + 3 < TemplateClass.M_SYXT.list_lbv_syxt_mblb_index.Count)
                 {
-                    set_syt_pic(TemplateClass, TemplateClass.M_SYXT.list_lbv_syxt_mblb_index[i+3], Color_list, new PointF(343.8f, NeueStartposition + 345+5));
+                    set_syt_pic(TemplateClass, TemplateClass.M_SYXT.list_lbv_syxt_mblb_index[i + 3], Color_list, new PointF(343.8f, NeueStartposition + 345));
                 }
 
-
                 XRLine rLine = new XRLine();
                 rLine.SizeF = new SizeF(5f, 698.5f);
                 rLine.LineDirection = LineDirection.Vertical;
-                rLine.LocationF = new PointF(335f, NeueStartposition+2);
+                rLine.LocationF = new PointF(335f, NeueStartposition + 2);
                 this.Detail.Controls.Add(rLine);
 
                 XRLine rLine_level = new XRLine();
@@ -830,8 +851,10 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
 
                 XRPageBreak xRPage = new XRPageBreak();
                 xRPage.LocationF = new PointF(0, NeueStartposition + 850);
+                this.Detail.Controls.Add(xRPicture);
                 NeueStartposition = NeueStartposition + 870;
                 this.Detail.Controls.Add(xRPage);
+
             }
 
         }
@@ -843,12 +866,12 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         {
             XRPageBreak xRPage = new XRPageBreak();
             xRPage.Name = "kllb_Page";
-            xRPage.LocationF = new PointF(0, NeueStartposition + 2);
+            xRPage.LocationF = new PointF(0, NeueStartposition);
             this.Detail.Controls.Add(xRPage);
             xrTable_kllb_surface.LocationF = new PointF(0, NeueStartposition + 5);
             xrTable_kllb_surface.Visible = true;
             NeueStartposition = xrTable_kllb_surface.LocationF.Y + xrTable_kllb_surface.SizeF.Height;
-            xrTableCell2.Text = "Selected particles based on:" + TemplateClass.M_KLLBXX.str_cb_kllb_sort_p1.ToString()+ "(μm)";
+            xrTableCell2.Text = "Selected particles based on:" + TemplateClass.M_KLLBXX.str_cb_kllb_sort_p1.ToString() + "(μm)";
             DataTable dataTable = export_ReportTemplate.Get_dev_kllb_data(TemplateClass);
 
             for (int i = 0; i < dataTable.Rows.Count; i++)
@@ -871,9 +894,9 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         {
             export_ReportTemplate.Get_dev_kllb_data_frame(TemplateClass, out DataTable dt_pic, out List<DataTable> listData);
 
-            for (int i=0;i< listData.Count;i++)
+            for (int i = 0; i < listData.Count; i++)
             {
-                for (int a=0;a< listData[i].Rows.Count;a++)
+                for (int a = 0; a < listData[i].Rows.Count; a++)
                 {
                     listData[i].Rows[a]["Class"] = subscript.Getsubscriptstring(listData[i].Rows[a]["Class"].ToString());
                 }
@@ -937,19 +960,19 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
                             xRTable.Rows[0].Cells[2].Text = TemplateClass.M_KLLBXX.str_cb_kllb_chartSort_p1.ToString();
                             xRTable.Rows[0].Cells[3].Text = TemplateClass.M_KLLBXX.str_cb_kllb_chartSort_p2.ToString();
 
-                        
+
                             xRTable.Rows[1].Cells[1].Text = listData[a].Rows[b]["Class"].ToString();
                             xRTable.Rows[1].Cells[2].Text = listData[a].Rows[b]["pid"].ToString();
                             xRTable.Rows[1].Cells[3].Text = listData[a].Rows[b]["Size"].ToString();
 
                             for (int c = 1; c < 10; c++)
                             {
-                                
+
                                 xRTable.Rows[2].Cells[c].Text = listData[a].Rows[b]["ColName" + (c).ToString()].ToString();
                                 xRTable.Rows[3].Cells[c].Text = listData[a].Rows[b]["ColVal" + (c).ToString()].ToString();
                             }
 
-                            xRTable.LocationF = new PointF(0, NeueStartposition );
+                            xRTable.LocationF = new PointF(0, NeueStartposition);
 
                             XRPictureBox xRPicture1 = new XRPictureBox();
                             xRPicture1.ImageSource = new ImageSource((Bitmap)listData[a].Rows[b]["pic"]);
@@ -960,7 +983,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
                             //xRTable.Rows[1].Cells[0].Controls.Add(xRPicture1);
                             this.Detail.Controls.Add(xRTable);
                             this.Detail.Controls.Add(xRPicture1);
-                            NeueStartposition = NeueStartposition + xRTable.SizeF.Height +1 ;
+                            NeueStartposition = NeueStartposition + xRTable.SizeF.Height + 1;
                         }
                     }
                 }
@@ -1122,13 +1145,9 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         /// <param name="index"></param>
         private void set_syt_pic(c_TemplateClass TemplateClass, int index, List<Color> Color_list, PointF position)
         {
-
-
             XRPictureBox xRPicture = new XRPictureBox();
-
             xRPicture.LocationF = position;
             xRPicture.SizeF = new SizeF(321f, 330.2f);
-
             ImageSource imageSource = new ImageSource(export_ReportTemplate.DrawATernaryPicture(index, TemplateClass, Color_list));
             xRPicture.ImageSource = imageSource;
             xRPicture.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage;
@@ -1137,17 +1156,17 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
 
         }
 
-        private void set_syt_pic_legend(List<Color> Color_list)
+        private XRPictureBox set_syt_pic_legend(List<Color> Color_list, int i)
         {
             XRPictureBox xRPicture_legend = new XRPictureBox();
-         
+            xRPicture_legend.Name = "XRPicture" + i.ToString();
             xRPicture_legend.LocationF = new PointF(400f, NeueStartposition);
             xRPicture_legend.SizeF = new SizeF(260f, 120f);
             xRPicture_legend.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage;
             ImageSource imageSource_legend = new ImageSource(export_ReportTemplate.DrawATernaryDiagramLegend(Color_list));
             xRPicture_legend.ImageSource = imageSource_legend;
-            NeueStartposition = NeueStartposition + xRPicture_legend.SizeF.Height;
-            this.Detail.Controls.Add(xRPicture_legend);
+            NeueStartposition = xRPicture_legend.LocationF.Y + xRPicture_legend.SizeF.Height;
+            return xRPicture_legend;
         }
         #endregion
 
@@ -1166,7 +1185,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             Template.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
             Template.LocationF = new PointF(30.42f, NeueStartposition);
             Template.BackColor = Color.DarkGray;
-            NeueStartposition = NeueStartposition + Template.SizeF.Height;
+            NeueStartposition = Template.LocationF.Y + Template.SizeF.Height;
             return Template;
         }
 
@@ -1175,7 +1194,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         {
             XRTable Template = new XRTable();
             XRTableRow Template_Rows_1 = new XRTableRow();
-            
+
             XRTableCell Template_Rows1_Cell_2 = new XRTableCell();
             XRTableCell Template_Rows1_Cell_3 = new XRTableCell();
             XRTableCell Template_Rows1_Cell_4 = new XRTableCell();
@@ -1183,7 +1202,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             XRTableCell Template_Rows1_Cell_6 = new XRTableCell();
 
             XRTableRow Template_Rows_2 = new XRTableRow();
-           
+
             XRTableCell Template_Rows2_Cell_2 = new XRTableCell();
             XRTableCell Template_Rows2_Cell_3 = new XRTableCell();
             XRTableCell Template_Rows2_Cell_4 = new XRTableCell();
@@ -1191,7 +1210,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             XRTableCell Template_Rows2_Cell_6 = new XRTableCell();
 
             XRTableRow Template_Rows_3 = new XRTableRow();
-          
+
             XRTableCell Template_Rows3_Cell_2 = new XRTableCell();
             XRTableCell Template_Rows3_Cell_3 = new XRTableCell();
             XRTableCell Template_Rows3_Cell_4 = new XRTableCell();
@@ -1204,7 +1223,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             XRTableCell Template_Rows3_Cell_11 = new XRTableCell();
 
             XRTableRow Template_Rows_4 = new XRTableRow();
-           
+
             XRTableCell Template_Rows4_Cell_2 = new XRTableCell();
             XRTableCell Template_Rows4_Cell_3 = new XRTableCell();
             XRTableCell Template_Rows4_Cell_4 = new XRTableCell();
@@ -1221,7 +1240,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             XRTableCell Template_Rows5_Cell_2 = new XRTableCell();
 
             Template.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
-        
+
             Template_Rows1_Cell_2.WidthF = 57.22f;
             Template_Rows1_Cell_3.WidthF = 256f;
             Template_Rows1_Cell_4.WidthF = 85.85f;
@@ -1246,7 +1265,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             Template_Rows_2.Controls.Add(Template_Rows2_Cell_5);
             Template_Rows_2.Controls.Add(Template_Rows2_Cell_6);
 
-            
+
             Template_Rows3_Cell_2.WidthF = 57.23f;//63.59f
             Template_Rows3_Cell_3.WidthF = 57.23f;
             Template_Rows3_Cell_4.WidthF = 57.23f;
@@ -1258,7 +1277,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             Template_Rows3_Cell_10.WidthF = 57.23f;
             Template_Rows3_Cell_11.WidthF = 57.23f;
 
-            
+
             Template_Rows_3.Controls.Add(Template_Rows3_Cell_2);
             Template_Rows_3.Controls.Add(Template_Rows3_Cell_3);
             Template_Rows_3.Controls.Add(Template_Rows3_Cell_4);
@@ -1270,7 +1289,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             Template_Rows_3.Controls.Add(Template_Rows3_Cell_10);
             Template_Rows_3.Controls.Add(Template_Rows3_Cell_11);
 
-           
+
             Template_Rows4_Cell_2.WidthF = 57.23f;//63.59f
             Template_Rows4_Cell_3.WidthF = 57.23f;
             Template_Rows4_Cell_4.WidthF = 57.23f;
@@ -1305,7 +1324,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             Template.Rows.Add(Template_Rows_4);
             Template.Rows.Add(Template_Rows_5);
             Template.SizeF = new SizeF(688f, 125);
-          
+
             Template.Rows[0].Font = new Font(Schriftart_english, 12f);
             Template.Rows[2].Font = new Font(Schriftart_english, 12f);
             Template.Rows[1].Font = new Font(Schriftart_english, 12f);
@@ -1313,7 +1332,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
 
             Template.Rows[0].BackColor = Color.DarkGray;
             Template.Rows[2].BackColor = Color.DarkGray;
-    
+
             Template.Rows[2].BackColor = Color.DarkGray;
 
             Template.Borders = DevExpress.XtraPrinting.BorderSide.All;
@@ -1340,15 +1359,15 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
 
             for (int i = 0; i < 10; i++)
             {
-                table.Rows[2].Cells[i].Text = dataTable.Rows[position]["ColName" + (i+1).ToString()].ToString();
+                table.Rows[2].Cells[i].Text = dataTable.Rows[position]["ColName" + (i + 1).ToString()].ToString();
                 string str_ColVal = "";
-                if (dataTable.Rows[position]["ColVal" + (i+1).ToString()].ToString() == "0")
+                if (dataTable.Rows[position]["ColVal" + (i + 1).ToString()].ToString() == "0")
                 {
                     str_ColVal = "";
                 }
                 else
                 {
-                    str_ColVal = dataTable.Rows[position]["ColVal" + (i+1).ToString()].ToString();
+                    str_ColVal = dataTable.Rows[position]["ColVal" + (i + 1).ToString()].ToString();
                 }
                 table.Rows[3].Cells[i].Text = str_ColVal;
             }
@@ -1360,7 +1379,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             xRPicture3.ImageSource = new ImageSource((Bitmap)dataTable.Rows[position]["p1"]);
             xRPicture3.SizeF = new SizeF(117f, 121f);
             xRPicture3.Sizing = DevExpress.XtraPrinting.ImageSizeMode.Squeeze;
-            
+
             table.Rows[4].Cells[0].Controls.Add(xRPicture3);
             table.Rows[4].Cells[1].Controls.Add(xRPicture2);
             table.Visible = true;
@@ -1489,7 +1508,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             //Transparent
             Template.Borders = DevExpress.XtraPrinting.BorderSide.All;
             Template.SizeF = new SizeF(688f, 30);
-            Template.Font= new Font(Schriftart_english, 12f);
+            Template.Font = new Font(Schriftart_english, 12f);
             return Template;
         }
 
@@ -1505,9 +1524,9 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             }
             else
             {
-                xrLabel_pageinfo.Font= new Font(Schriftart_chinese, dev_classify.Font.Size);
+                xrLabel_pageinfo.Font = new Font(Schriftart_chinese, dev_classify.Font.Size);
                 this.xrLabel_pageinfo.Visible = true;
-                this.xrLabel_pageinfo.Text = string.Format("第{0}页,共{1}页", pageindex , pagecount - 1);
+                this.xrLabel_pageinfo.Text = string.Format("第{0}页,共{1}页", pageindex, pagecount - 1);
             }
         }
     }