Преглед на файлове

Merge branch 'cxs_release2.31' into release2.31

cxs преди 3 години
родител
ревизия
480d1b7ef5

+ 343 - 54
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs

@@ -1,5 +1,8 @@
 using NPOI.HSSF.UserModel;
 using NPOI.SS.UserModel;
+using NPOI.SS.UserModel.Charts;
+using NPOI.SS.Util;
+using NPOI.XSSF.UserModel;
 using OTSIncAReportApp;
 using OTSIncAReportApp.DataOperation.DataAccess;
 using OTSIncAReportApp.DataOperation.Model;
@@ -21,6 +24,7 @@ using System.Reflection;
 using System.Threading;
 using System.Windows.Forms;
 
+
 namespace OTSIncAReportGrids
 {
     public partial class ParticlesGridDevidePage : UserControl
@@ -82,11 +86,12 @@ namespace OTSIncAReportGrids
         string str_SysType = "";//当前启动模式(夹杂物、清洁度)
         frmReportConditionChoose m_condition;
         FieldData fieldData;
-		DataTable particlesAll;
+        DataTable particlesAll;
+        DataTable particles;
         ParticleData Particledata;
         UserLibraryData userLibrary;
         DataTable userLibraryData;
-        NLog.Logger log= NLog.LogManager.GetCurrentClassLogger();
+        NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
 
         #region 分页器相关
 
@@ -173,15 +178,15 @@ namespace OTSIncAReportGrids
             resultFile = ReportApp.m_rstDataMgr.CurResultFile;
             ReportFun = new OTSImageDisHelp(resultFile);
 
-            string sou=m_condition.m_CurrentConditions[OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE].itemDisplayVal.ToString();
+            string sou = m_condition.m_CurrentConditions[OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE].itemDisplayVal.ToString();
             if (sou.Contains("+"))
             {
-                result=m_ReportApp.m_rstDataMgr.ResultFilesList[0];
-            }else
+                result = m_ReportApp.m_rstDataMgr.ResultFilesList[0];
+            } else
             {
-                for(int i=0;i < m_ReportApp.m_rstDataMgr.ResultFilesList.Count;i++)
+                for (int i = 0; i < m_ReportApp.m_rstDataMgr.ResultFilesList.Count; i++)
                 {
-                    if (sou== m_ReportApp.m_rstDataMgr.ResultFilesList[i].FileName.ToString())
+                    if (sou == m_ReportApp.m_rstDataMgr.ResultFilesList[i].FileName.ToString())
                     {
                         result = m_ReportApp.m_rstDataMgr.ResultFilesList[i];
                     }
@@ -209,14 +214,14 @@ namespace OTSIncAReportGrids
                 lan = new Language(this);
                 table = lan.GetNameTable(this.Name);
 
-            
+
                 m_mythread_state = false;
                 m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
                 //m_frm_userprogress = new Frm_UserProgress();
                 fieldData = new FieldData(result.FilePath);
                 Particledata = new ParticleData(result.FilePath);
                 str_SysType = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)result.ResultInfo["Sample"])["Members"])["MsrParams"])["SysType"].ToString();
-                if (str_SysType== "0:IncA")
+                if (str_SysType == "0:IncA")
                 {
                     userLibraryData = null;
                 }
@@ -237,12 +242,12 @@ namespace OTSIncAReportGrids
                 m_OTSIncAReportGridsFun = new OTSReportGridsFun(m_ReportApp, this);
                 return true;
             }
-            catch(Exception ex)
+            catch (Exception ex)
             {
                 log.Error(ex.ToString());
                 return false;
             }
-            
+
         }
         private void ParticlesGridDevidePage_Load(object sender, EventArgs e)
         {
@@ -261,7 +266,7 @@ namespace OTSIncAReportGrids
             {
                 return;
             }
-           
+
             cbB_PageSize.Items.Add("20");
             cbB_PageSize.Items.Add("100");
             cbB_PageSize.Items.Add("500");
@@ -311,10 +316,10 @@ namespace OTSIncAReportGrids
                 dtUelect.Columns.Add("Hardness");
                 dtUelect.Columns.Add("Density");
                 dtUelect.Columns.Add("Electrical_conductivity");
-                for (int i=0;i< selectParticles.Count;i++)
+                for (int i = 0; i < selectParticles.Count; i++)
                 {
                     dtUelect.Rows.Add(selectParticles[i].FieldId, selectParticles[i].ParticleId, selectParticles[i].AveGray, selectParticles[i].RectLeft, selectParticles[i].RectTop, selectParticles[i].RectWidth, selectParticles[i].RectHeight, selectParticles[i].Area, selectParticles[i].PosX, selectParticles[i].PosX, selectParticles[i].TypeId, /*selectParticles[i].ElementNum,*/ selectParticles[i].SegmentNum, selectParticles[i].SEMPosX, selectParticles[i].SEMPosY, selectParticles[i].ParticleId, selectParticles[i].DMAX, selectParticles[i].DMIN, selectParticles[i].DPERP, selectParticles[i].PERIMETER, selectParticles[i].ORIENTATION, selectParticles[i].DINSCR, selectParticles[i].DMEAN, selectParticles[i].DELONG, selectParticles[i].DFERET, selectParticles[i].TypeName, selectParticles[i].TypeColor, "", "", "", "", "");
-                 }
+                }
                 if (userLibraryData != null)
                 {
                     for (int i = 0; i < dtUelect.Rows.Count; i++)
@@ -355,12 +360,12 @@ namespace OTSIncAReportGrids
                 particlesAll.Columns.Add("Hardness");
                 particlesAll.Columns.Add("Density");
                 particlesAll.Columns.Add("Electrical_conductivity");
-                if(userLibraryData != null)
+                if (userLibraryData != null)
                 {
-                    for(int i=0;i< particlesAll.Rows.Count;i++)
+                    for (int i = 0; i < particlesAll.Rows.Count; i++)
                     {
                         DataRow[] dr = userLibraryData.Select("STDId=" + particlesAll.Rows[i]["TypeId"].ToString());
-                        if (dr.Length>0)
+                        if (dr.Length > 0)
                         {
                             particlesAll.Rows[i]["Hardness"] = System.Text.RegularExpressions.Regex.Replace(dr[0]["Hardness"].ToString(), @"[^\d.\d]", "");
                             particlesAll.Rows[i]["Density"] = System.Text.RegularExpressions.Regex.Replace(dr[0]["Density"].ToString(), @"[^\d.\d]", "");
@@ -395,7 +400,7 @@ namespace OTSIncAReportGrids
                 }
                 btn_Sel.Enabled = true;
             }
-            if(particlesAll==null)
+            if (particlesAll == null)
             {
                 log.Error("There is an exception in the data of the database!");
                 #region 加载进度条进度部份结束
@@ -726,7 +731,7 @@ namespace OTSIncAReportGrids
 
                 }
             }
-            if(PageSize==-1)
+            if (PageSize == -1)
             {
                 PageSize = particlesAll.Rows.Count;
             }
@@ -736,7 +741,7 @@ namespace OTSIncAReportGrids
                 return;
             }
             RecordCount = particlesAll.Rows.Count;
-            DataTable particles = particlesAll.Clone();
+            particles = particlesAll.Clone();
             for (int fi = (PageIndex - 1) * pageSize; fi < PageIndex * pageSize; fi++)
             {
                 if (fi > RecordCount - 1)
@@ -875,7 +880,7 @@ namespace OTSIncAReportGrids
                     }
                 }
             }
-            
+
 
             #region 加载进度条进度部份结束
             //加载完成设置鼠标为默认
@@ -1102,7 +1107,7 @@ namespace OTSIncAReportGrids
                 if (m_OTSIncAReportGridsFun.m_SEMConnectionState == true)
                 {
                     m_OTSIncAReportGridsFun.MoveSemToPointXY_ForParticlesGrid(sem_point.X, sem_point.Y);
-                
+
                 }
 
                 Thread.Sleep(1500);
@@ -1314,7 +1319,7 @@ namespace OTSIncAReportGrids
         /// <param name="min"></param>
         /// <param name="max"></param>
         /// <returns></returns>
-        bool CompareInput(string min,string max)
+        bool CompareInput(string min, string max)
         {
             int imax = 0;
             int imin = 0;
@@ -1336,7 +1341,7 @@ namespace OTSIncAReportGrids
             {
                 dmin = Convert.ToDouble(min);
             }
-            if(dmin<=dmax)
+            if (dmin <= dmax)
             {
                 return true;
             }
@@ -1357,7 +1362,7 @@ namespace OTSIncAReportGrids
                 {
                     condition += " and Area" + " > " + tBx_AreaMin.Text;
                 }
-                else if(int.TryParse(tBx_AreaMin.Text, out inum) && inum >= 0)
+                else if (int.TryParse(tBx_AreaMin.Text, out inum) && inum >= 0)
                 {
                     condition += " and Area" + " > " + tBx_AreaMin.Text;
                 }
@@ -1395,7 +1400,7 @@ namespace OTSIncAReportGrids
                     return;
                 }
             }
-            
+
 
             if (!string.IsNullOrWhiteSpace(tbx_DmaxMin.Text))
             {
@@ -1405,7 +1410,7 @@ namespace OTSIncAReportGrids
                 {
                     condition += " and DMAX" + " > " + tbx_DmaxMin.Text;
                 }
-                else if(int.TryParse(tbx_DmaxMin.Text, out inum)&& inum >= 0)
+                else if (int.TryParse(tbx_DmaxMin.Text, out inum) && inum >= 0)
                 {
                     condition += " and DMAX" + " > " + tbx_DmaxMin.Text;
                 }
@@ -1424,7 +1429,7 @@ namespace OTSIncAReportGrids
                 {
                     condition += " and DMAX" + "<" + tbx_DmaxMax.Text;
                 }
-                else if(int.TryParse(tbx_DmaxMax.Text, out inum)&& inum >= 0)
+                else if (int.TryParse(tbx_DmaxMax.Text, out inum) && inum >= 0)
                 {
                     condition += " and DMAX" + "<" + tbx_DmaxMax.Text;
                 }
@@ -1543,7 +1548,7 @@ namespace OTSIncAReportGrids
                 lnkNext.Enabled = false;
                 lnkLast.Enabled = false;
             }
-            
+
         }
         private void SetFormCtrEnabled()
         {
@@ -1632,16 +1637,16 @@ namespace OTSIncAReportGrids
         /// <summary>
         /// 在帧图上标记颗粒的位置矩形,并保存到FIELD_FILES_MARK文件夹中
         /// </summary>
-        public void SaveMarkParticleRectangleOnFieldFile(string str_resultPath, DataTable dataTable ,out List<string> vs , out DataTable dt_FIeld)
+        public void SaveMarkParticleRectangleOnFieldFile(string str_resultPath, DataTable dataTable, out List<string> vs, out DataTable dt_FIeld)
         {
             Init();
 
             List<string> maxlength = new List<string>();
-            for (int i=0;i< dataTable.Rows.Count;i++)
+            for (int i = 0; i < dataTable.Rows.Count; i++)
             {
-                if (dataTable.Rows[i]["TypeName"].ToString()!= "Not Identified")
+                if (dataTable.Rows[i]["TypeName"].ToString() != "Not Identified")
                 {
-                    if (maxlength.Count<10)
+                    if (maxlength.Count < 10)
                     {
                         maxlength.Add(dataTable.Rows[i]["Fieldid"].ToString());
                     }
@@ -1686,7 +1691,7 @@ namespace OTSIncAReportGrids
                 dt.Columns.Add("fieldid");
                 dt.Columns.Add("id");
                 dt.Columns.Add("fieldName");
-                dt.Columns.Add("cunt",typeof(int));
+                dt.Columns.Add("cunt", typeof(int));
                 dt.Columns.Add("fieldFullName");
                 for (int i = 0; i < max_list.Count; i++)
                 {
@@ -1722,7 +1727,7 @@ namespace OTSIncAReportGrids
                 //dv.Sort = "cunt DESC";
                 dt_FIeld = dt.Copy();
 
-                for (int i=0;i< dt_FIeld.Rows.Count; i++)
+                for (int i = 0; i < dt_FIeld.Rows.Count; i++)
                 {
                     if (dataTable.Select(dt_FIeld.Rows[i]["fieldid"].ToString()).Count() > 0)
                     {
@@ -1742,7 +1747,7 @@ namespace OTSIncAReportGrids
                         img.Dispose();
                         img = null;
 
-                       
+
                         //循环将颗粒,进行标记到bitmap图上
                         DataRow[] drlist = dt_AllParticle.Select(dt_FIeld.Rows[i]["fieldid"].ToString());
                         if (drlist.Count() > 0)
@@ -1771,7 +1776,7 @@ namespace OTSIncAReportGrids
                             {
                                 ls_offsetx = offset_rect.X - 10;
                             }
-                           
+
                             g.DrawString(dt_FIeld.Rows[i]["id"].ToString() + "" + str_particleid.ToString(),
                                 new Font("黑体", 8), new SolidBrush(Color.Aqua), new PointF(ls_offsetx, offset_rect.Y));
 
@@ -1797,19 +1802,21 @@ namespace OTSIncAReportGrids
 
         private void EXCELToolStripMenuItem_Click(object sender, EventArgs e)
         {
-            //将所有的数据导出到EXCEL中
-            SaveFileDialog sfd = new SaveFileDialog();
-            sfd.Filter = "Excel File(*.xls)|*.xls";
-            //设置默认文件类型显示顺序
-            sfd.FilterIndex = 1;
+            OTSIncAReportApp._1_UI.Control_Grids.SpectrumExportConfirmation sfd = new OTSIncAReportApp._1_UI.Control_Grids.SpectrumExportConfirmation();
+            
+            ////将所有的数据导出到EXCEL中
+            //SaveFileDialog sfd = new SaveFileDialog();
+            //sfd.Filter = "Excel File(*.xlsx)|*.xlsx";
+            ////设置默认文件类型显示顺序
+            //sfd.FilterIndex = 1;
 
-            //保存对话框是否记忆上次打开的目录
-            sfd.RestoreDirectory = true;
+            ////保存对话框是否记忆上次打开的目录
+            //sfd.RestoreDirectory = true;
 
             if (sfd.ShowDialog() == DialogResult.OK)
             {
-                IWorkbook workbook = new HSSFWorkbook();   //用于创建.xls  office2003开始以前的
-                //IWorkbook workbook = new XSSFWorkbook();        //用于创建.xlsx office2007开始以后的
+                //IWorkbook workbook = new HSSFWorkbook();   //用于创建.xls  office2003开始以前的
+                IWorkbook workbook = new NPOI.XSSF.UserModel.XSSFWorkbook();        //用于创建.xlsx office2007开始以后的
                 ISheet sheet;
 
                 //创建Excel文件
@@ -1817,6 +1824,7 @@ namespace OTSIncAReportGrids
                 fs.Close();
 
                 sheet = workbook.CreateSheet("Particles");//创建工作表
+                
 
                 //创建表格边框样式风格
                 ICellStyle cellStyle = workbook.CreateCellStyle();
@@ -1888,11 +1896,18 @@ namespace OTSIncAReportGrids
 
                             //图像效果不好,自己另外导出吧,这里对该列宽进行了设置0
                         }
+                        //else if(i_cell==0)
+                        //{
+                        //    ICreationHelper createHelper = workbook.GetCreationHelper();
+                        //    XSSFHyperlink link = (XSSFHyperlink)createHelper.CreateHyperlink(HyperlinkType.Url);
+                        //    link.Address=;
+                        //    cell.Hyperlink.Address(link);
+                        //}
                         else
                         {
                             //非图像列
                             double dbl = 0;
-                            if(double.TryParse(dgV_ParticlesDevidePage[i_cell, i_row].Value.ToString(),out dbl))
+                            if (double.TryParse(dgV_ParticlesDevidePage[i_cell, i_row].Value.ToString(), out dbl))
                             {
                                 cell.SetCellValue(dbl);
                             }
@@ -1906,10 +1921,112 @@ namespace OTSIncAReportGrids
                 }
 
                 ISheet sheet2;
-                sheet2 = workbook.CreateSheet("Peak spectrum");//创建工作表
-                //设置颗粒名列宽
-                sheet.SetColumnWidth(1, 30 * 256);//夹杂物名列宽
+                sheet2 = workbook.CreateSheet("Peak spectrum Data");//创建工作表
+                //插入表头
+                row = sheet2.CreateRow(1);
+                row.Height = 30 * 20;
+                cell = row.CreateCell(0);
+                cell.CellStyle = cellStyle;
+                cell.SetCellValue("rowid");
+
+                for (int i_cell = 1; i_cell < 2001; i_cell++)
+                {
+                   cell = row.CreateCell(i_cell);
+                   cell.CellStyle = cellStyle;
+                    if (i_cell == 1)
+                    {
+                        cell.SetCellValue("PeakSpectrumData");
+                    }
+                }
+
+                sheet2.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(1, 1, 1, 2000));
+
+                for (int j = 0; j < particles.Rows.Count; j++)
+                {
+                    row = sheet2.CreateRow(2 + j);
+                    cell = row.CreateCell(0);
+                    cell.CellStyle = cellStyle;
+                    cell.SetCellValue(j + 1);
+                    var tmpPart = Particledata.GetParticleXrayDataByFidAndPid(particles.Rows[j]["fieldid"].ToString(), particles.Rows[j]["particleid"].ToString());
+                    if (tmpPart != null)
+                    {
+                        if (tmpPart.XrayId > -1)
+                        {
+                            uint[] Analysis_xray = new uint[2000];
+                            for (int i = 0; i < 2000; i++)
+                            {
+                                Analysis_xray[i] = BitConverter.ToUInt32(tmpPart.XRayData, i * 4);
+                                cell = row.CreateCell(i + 1);
+                                cell.CellStyle = cellStyle;
+                                cell.SetCellValue(Analysis_xray[i]);
+                            }
+
+                        }
+
+                    }
+                }
+
+                if (sfd.SpectrumConfirmation)
+                {
+                    ISheet sheet3;
+                    sheet3 = workbook.CreateSheet("Peak spectrum");
+                    sheet3.SetColumnWidth(1, 200 * 256);//图像列宽
+                                                        //插入表头
+                    row = sheet3.CreateRow(1);
+                    row.Height = 30 * 20;
+                    cell = row.CreateCell(0);
+                    cell.CellStyle = cellStyle;
+                    cell.SetCellValue("rowid");
+
+                    cell = row.CreateCell(1);
+                    cell.CellStyle = cellStyle;
+                    cell.SetCellValue("PeakSpectrum");
 
+                    IDrawing drawing;
+                    IClientAnchor anchor3;
+                    for (int j = 0; j < particles.Rows.Count; j++)
+                    {
+                        row = sheet3.CreateRow(j + 2);
+                        row.Height = 120 * 20;
+                        cell = row.CreateCell(0);
+                        cell.CellStyle = cellStyle;
+                        cell.SetCellValue(j + 1);
+                        cell = row.CreateCell(1);
+                        cell = row.CreateCell(2);
+                        cell = row.CreateCell(3);
+                        drawing = sheet3.CreateDrawingPatriarch();
+                        //锚点
+                        anchor3 = drawing.CreateAnchor(0, 0, 0, 0, 1, j + 2, 2, j + 3);//XSSFClientAnchor(dx1,dy1,dx2,dy2,col1,row1,col2,row2);参数说明:dx1 dy1 起始单元格中的x,y坐标.dx2 dy2 结束单元格中的x,y坐标col1, row1 指定起始的单元格,下标从0开始col2, row2 指定结束的单元格,下标从0开始
+                        CreateChart(drawing, sheet2, anchor3, j + 2);
+                    }
+                    //row = sheet3.CreateRow(2);
+                    //row.Height = 120 * 20;
+                    //cell = row.CreateCell(0);
+                    //cell.CellStyle = cellStyle;
+                    //cell.SetCellValue(1);
+                    //cell = row.CreateCell(1);
+                    //cell = row.CreateCell(2);
+                    //cell = row.CreateCell(3);
+
+                    //drawing = sheet3.CreateDrawingPatriarch();
+                    ////锚点
+                    //anchor3 = drawing.CreateAnchor(0, 0, 0, 0, 1, 2, 2, 3);//XSSFClientAnchor(dx1,dy1,dx2,dy2,col1,row1,col2,row2);参数说明:dx1 dy1 起始单元格中的x,y坐标.dx2 dy2 结束单元格中的x,y坐标col1, row1 指定起始的单元格,下标从0开始col2, row2 指定结束的单元格,下标从0开始
+                    //CreateChart(drawing, sheet2, anchor3, 2);
+
+                    //row = sheet3.CreateRow(3);
+                    //row.Height = 120 * 20;
+                    //cell = row.CreateCell(0);
+                    //cell.CellStyle = cellStyle;
+                    //cell.SetCellValue(1);
+                    //cell = row.CreateCell(1);
+                    //cell = row.CreateCell(2);
+                    //cell = row.CreateCell(3);
+
+                    //drawing = sheet3.CreateDrawingPatriarch();
+                    ////锚点
+                    //anchor3 = drawing.CreateAnchor(0, 0, 0, 0, 1, 3, 2, 4);//XSSFClientAnchor(dx1,dy1,dx2,dy2,col1,row1,col2,row2);参数说明:dx1 dy1 起始单元格中的x,y坐标.dx2 dy2 结束单元格中的x,y坐标col1, row1 指定起始的单元格,下标从0开始col2, row2 指定结束的单元格,下标从0开始
+                    //CreateChart(drawing, sheet2, anchor3, 3);
+                }
 
                 //完成后,对Excel进行保存
                 FileStream file = new FileStream(sfd.FileName, FileMode.Create);
@@ -1925,11 +2042,51 @@ namespace OTSIncAReportGrids
                     System.Diagnostics.Process.Start(sfd.FileName);
                 }
 
+                // 生成一个 单元格 对象 HSSFCell cellTableName = CreateCell(sheetTableIndex, t + 1, 0, strTableName, true); 
+                //创建一个超链接对象 HSSFHyperlink link = new HSSFHyperlink(HSSFHyperlink.LINK_DOCUMENT); 
+                // strTableName 这个参数为 sheet名字 A1 为单元格 其他是固定格式 link.Address = "#" + strTableName + "!A1"; 
+                //设置 cellTableName 单元格 的连接对象 cellTableName.Hyperlink = link;
+
+
 
             }
         }
 
+        void CreateChart(IDrawing drawing, ISheet sheet, IClientAnchor anchor, int rowid)
+        {
+            var chart = drawing.CreateChart(anchor) as XSSFChart;
+            // 创建图形注释的位置
+            //var legend = chart.GetOrCreateLegend();
+            //legend.Position = LegendPosition.Top;
+
+
+            //图表
+            var data = chart.ChartDataFactory.CreateLineChartData<double, double>(); //折线图
 
+            IChartAxis bottomAxis = chart.ChartAxisFactory.CreateCategoryAxis(AxisPosition.Bottom);
+            
+            IValueAxis leftAxis = chart.ChartAxisFactory.CreateValueAxis(AxisPosition.Left);
+            leftAxis.Crosses=AxisCrosses.AutoZero;
+            leftAxis.IsVisible = true;
+            bottomAxis.IsVisible = true;
+            //数据源
+            IChartDataSource<double> ys = DataSources.FromNumericCellRange(sheet, new CellRangeAddress(rowid, rowid, 1, 2001));
+
+            Double[] doubles = new Double[2000];
+            for (int i = 0; i < 2000; i++)
+            {
+                doubles[i] = i;
+            }
+            IChartDataSource<double> xs = DataSources.FromArray(doubles);
+            //IChartDataSource<double> ys = DataSources.FromArray(doubles);
+
+            //数据系列
+            var s1 = data.AddSeries(xs, ys);
+
+            // 开始绘制折线图
+            chart.Plot(data, bottomAxis, leftAxis);
+
+        }
         /// <summary>
         /// 将image转成bytes
         /// </summary>
@@ -1954,7 +2111,7 @@ namespace OTSIncAReportGrids
             }
         }
 
-     
+
 
         private void ToolStripMenuItem_Delete_Particle_Click(object sender, EventArgs e)
         {
@@ -1980,10 +2137,10 @@ namespace OTSIncAReportGrids
                             if (ReportFun.DeleteParticlesFromLibrary(item.ParticleId, item.FieldId))
                             {
                                 MessageBox.Show("Deleted successfully");
-                                
-                                for (int i=0;i< particlesAll.Rows.Count;i++)
+
+                                for (int i = 0; i < particlesAll.Rows.Count; i++)
                                 {
-                                    if (particlesAll.Rows[i]["Fieldid"].ToString()== item.FieldId.ToString() && particlesAll.Rows[i]["Particleid"].ToString()==item.ParticleId.ToString())
+                                    if (particlesAll.Rows[i]["Fieldid"].ToString() == item.FieldId.ToString() && particlesAll.Rows[i]["Particleid"].ToString() == item.ParticleId.ToString())
                                     {
                                         particlesAll.Rows.RemoveAt(i);
                                     }
@@ -2004,9 +2161,141 @@ namespace OTSIncAReportGrids
             }
         }
 
+
+        #region 将DataTable中的数据写到Excel的指定Sheet中
+        /// <summary>
+        /// 将DataTable中的数据写到Excel的指定Sheet中
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="m_Sheet"></param>
+        public void DataTableToSheet(string title, DataTable dt, Microsoft.Office.Interop.Excel._Worksheet m_Sheet,
+                                    Microsoft.Office.Interop.Excel._Workbook m_Book, int startrow)
+        {
+
+            //以下是填写EXCEL中数据
+            Microsoft.Office.Interop.Excel.Range range = m_Sheet.get_Range(m_Sheet.Cells[1, 1], m_Sheet.Cells[1, 2]);
+            range.MergeCells = true;  //合并单元格
+            range.Font.Bold = true;   //加粗单元格内字符
+            //写入题目
+            m_Sheet.Cells[startrow, startrow] = title;
+            int rownum = dt.Rows.Count;//行数
+            int columnnum = dt.Columns.Count;//列数
+            int num = rownum + 2;   //得到数据中的最大行数
+
+
+            //写入列标题
+            for (int j = 0; j < columnnum; j++)
+            {
+                int bt_startrow = startrow + 1;
+
+                //将字段名写入文档
+                m_Sheet.Cells[bt_startrow, 1 + j] = dt.Columns[j].ColumnName;
+
+                //单元格内背景色
+                m_Sheet.get_Range(m_Sheet.Cells[bt_startrow, 1 + j], m_Sheet.Cells[bt_startrow, 1 + j]).Interior.ColorIndex = 15;
+            }
+
+
+            //逐行写入数据
+            for (int i = 0; i < rownum; i++)
+            {
+                for (int j = 0; j < columnnum; j++)
+                {
+                    m_Sheet.Cells[startrow + 2 + i, 1 + j] = dt.Rows[i][j].ToString();
+                }
+            }
+            m_Sheet.Columns.AutoFit();
+
+
+
+            //在当前工作表中根据数据生成图表
+
+            CreateChart(m_Book, m_Sheet, num);
+        }
+        private void CreateChart(Microsoft.Office.Interop.Excel._Workbook m_Book, Microsoft.Office.Interop.Excel._Worksheet m_Sheet, int num)
+        {
+            Microsoft.Office.Interop.Excel.Range oResizeRange;
+            Microsoft.Office.Interop.Excel.Series oSeries;
+
+            m_Book.Charts.Add(Missing.Value, Missing.Value, 1, Missing.Value);
+            m_Book.ActiveChart.ChartType = Microsoft.Office.Interop.Excel.XlChartType.xlLine;//设置图形
+
+            //设置数据取值范围
+            m_Book.ActiveChart.SetSourceData(m_Sheet.get_Range("A2", "C" + num.ToString()), Microsoft.Office.Interop.Excel.XlRowCol.xlColumns);
+            //m_Book.ActiveChart.Location(Microsoft.Office.Interop.Excel.XlChartLocation.xlLocationAutomatic, title);
+            //以下是给图表放在指定位置
+            m_Book.ActiveChart.Location(Microsoft.Office.Interop.Excel.XlChartLocation.xlLocationAsObject, m_Sheet.Name);
+            oResizeRange = (Microsoft.Office.Interop.Excel.Range)m_Sheet.Rows.get_Item(10, Missing.Value);
+            m_Sheet.Shapes.Item("Chart 1").Top = (float)(double)oResizeRange.Top;  //调图表的位置上边距
+            oResizeRange = (Microsoft.Office.Interop.Excel.Range)m_Sheet.Columns.get_Item(6, Missing.Value);  //调图表的位置左边距
+                                                                                                              // m_Sheet.Shapes.Item("Chart 1").Left = (float)(double)oResizeRange.Left;
+            m_Sheet.Shapes.Item("Chart 1").Width = 400;   //调图表的宽度
+            m_Sheet.Shapes.Item("Chart 1").Height = 250;  //调图表的高度
+
+            m_Book.ActiveChart.PlotArea.Interior.ColorIndex = 19;  //设置绘图区的背景色
+            m_Book.ActiveChart.PlotArea.Border.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlLineStyleNone;//设置绘图区边框线条
+            m_Book.ActiveChart.PlotArea.Width = 400;   //设置绘图区宽度
+            //m_Book.ActiveChart.ChartArea.Interior.ColorIndex = 10; //设置整个图表的背影颜色
+            //m_Book.ActiveChart.ChartArea.Border.ColorIndex = 8;// 设置整个图表的边框颜色
+            m_Book.ActiveChart.ChartArea.Border.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlLineStyleNone;//设置边框线条
+            m_Book.ActiveChart.HasDataTable = false;
+
+
+            //设置Legend图例的位置和格式
+            m_Book.ActiveChart.Legend.Top = 20.00; //具体设置图例的上边距
+            m_Book.ActiveChart.Legend.Left = 60.00;//具体设置图例的左边距
+            m_Book.ActiveChart.Legend.Interior.ColorIndex = Microsoft.Office.Interop.Excel.XlColorIndex.xlColorIndexNone;
+            m_Book.ActiveChart.Legend.Width = 150;
+            m_Book.ActiveChart.Legend.Font.Size = 9.5;
+            //m_Book.ActiveChart.Legend.Font.Bold = true;
+            m_Book.ActiveChart.Legend.Font.Name = "宋体";
+            //m_Book.ActiveChart.Legend.Position = Microsoft.Office.Interop.Excel.XlLegendPosition.xlLegendPositionTop;//设置图例的位置
+            m_Book.ActiveChart.Legend.Border.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlLineStyleNone;//设置图例边框线条
+
+
+
+            //设置X轴的显示
+            Microsoft.Office.Interop.Excel.Axis xAxis = (Microsoft.Office.Interop.Excel.Axis)m_Book.ActiveChart.Axes(Microsoft.Office.Interop.Excel.XlAxisType.xlValue, Microsoft.Office.Interop.Excel.XlAxisGroup.xlPrimary);
+            xAxis.MajorGridlines.Border.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlDot;
+            xAxis.MajorGridlines.Border.ColorIndex = 1;//gridLine横向线条的颜色
+            xAxis.HasTitle = false;
+            xAxis.MinimumScale = 1500;
+            xAxis.MaximumScale = 6000;
+            xAxis.TickLabels.Font.Name = "宋体";
+            xAxis.TickLabels.Font.Size = 9;
+
+
+
+            //设置Y轴的显示
+            Microsoft.Office.Interop.Excel.Axis yAxis = (Microsoft.Office.Interop.Excel.Axis)m_Book.ActiveChart.Axes(Microsoft.Office.Interop.Excel.XlAxisType.xlCategory, Microsoft.Office.Interop.Excel.XlAxisGroup.xlPrimary);
+            yAxis.TickLabelSpacing = 30;
+            yAxis.TickLabels.NumberFormat = "M月D日";
+            yAxis.TickLabels.Orientation = Microsoft.Office.Interop.Excel.XlTickLabelOrientation.xlTickLabelOrientationHorizontal;//Y轴显示的方向,是水平还是垂直等
+            yAxis.TickLabels.Font.Size = 8;
+            yAxis.TickLabels.Font.Name = "宋体";
+
+            //m_Book.ActiveChart.Floor.Interior.ColorIndex = 8;
+            /***以下是设置标题*****
+            m_Book.ActiveChart.HasTitle=true;
+            m_Book.ActiveChart.ChartTitle.Text = "净值指数";
+            m_Book.ActiveChart.ChartTitle.Shadow = true;
+            m_Book.ActiveChart.ChartTitle.Border.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
+            */
+
+            oSeries = (Microsoft.Office.Interop.Excel.Series)m_Book.ActiveChart.SeriesCollection(1);
+            oSeries.Border.ColorIndex = 45;
+            oSeries.Border.Weight = Microsoft.Office.Interop.Excel.XlBorderWeight.xlThick;
+            oSeries = (Microsoft.Office.Interop.Excel.Series)m_Book.ActiveChart.SeriesCollection(2);
+            oSeries.Border.ColorIndex = 9;
+            oSeries.Border.Weight = Microsoft.Office.Interop.Excel.XlBorderWeight.xlThick;
+
+        }
+
+        #endregion
     }
 
 
 
+
 }
 

+ 106 - 0
OTSIncAReportApp/1-UI/Control_Grids/SpectrumExportConfirmation.Designer.cs

@@ -0,0 +1,106 @@
+
+namespace OTSIncAReportApp._1_UI.Control_Grids
+{
+    partial class SpectrumExportConfirmation
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.tBox1 = new System.Windows.Forms.TextBox();
+            this.bt_Path = new System.Windows.Forms.Button();
+            this.cB_SpectrumConfirmation = new System.Windows.Forms.CheckBox();
+            this.bt_Export = new System.Windows.Forms.Button();
+            this.SuspendLayout();
+            // 
+            // tBox1
+            // 
+            this.tBox1.Location = new System.Drawing.Point(12, 23);
+            this.tBox1.Name = "tBox1";
+            this.tBox1.ReadOnly = true;
+            this.tBox1.Size = new System.Drawing.Size(568, 28);
+            this.tBox1.TabIndex = 0;
+            // 
+            // bt_Path
+            // 
+            this.bt_Path.Location = new System.Drawing.Point(607, 16);
+            this.bt_Path.MaximumSize = new System.Drawing.Size(188, 38);
+            this.bt_Path.MinimumSize = new System.Drawing.Size(188, 38);
+            this.bt_Path.Name = "bt_Path";
+            this.bt_Path.Size = new System.Drawing.Size(188, 38);
+            this.bt_Path.TabIndex = 1;
+            this.bt_Path.Text = "选择导出Ececl路径";
+            this.bt_Path.UseVisualStyleBackColor = true;
+            this.bt_Path.Click += new System.EventHandler(this.bt_Path_Click);
+            // 
+            // cB_SpectrumConfirmation
+            // 
+            this.cB_SpectrumConfirmation.AutoSize = true;
+            this.cB_SpectrumConfirmation.Location = new System.Drawing.Point(368, 89);
+            this.cB_SpectrumConfirmation.Name = "cB_SpectrumConfirmation";
+            this.cB_SpectrumConfirmation.Size = new System.Drawing.Size(196, 22);
+            this.cB_SpectrumConfirmation.TabIndex = 2;
+            this.cB_SpectrumConfirmation.Text = "附带颗粒能谱谱峰图";
+            this.cB_SpectrumConfirmation.UseVisualStyleBackColor = true;
+            this.cB_SpectrumConfirmation.CheckedChanged += new System.EventHandler(this.cB_SpectrumConfirmation_CheckedChanged);
+            // 
+            // bt_Export
+            // 
+            this.bt_Export.Location = new System.Drawing.Point(607, 86);
+            this.bt_Export.Name = "bt_Export";
+            this.bt_Export.Size = new System.Drawing.Size(188, 37);
+            this.bt_Export.TabIndex = 3;
+            this.bt_Export.Text = "导出Ececl";
+            this.bt_Export.UseVisualStyleBackColor = true;
+            this.bt_Export.Click += new System.EventHandler(this.bt_Export_Click);
+            // 
+            // SpectrumExportConfirmation
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(807, 140);
+            this.Controls.Add(this.bt_Export);
+            this.Controls.Add(this.cB_SpectrumConfirmation);
+            this.Controls.Add(this.bt_Path);
+            this.Controls.Add(this.tBox1);
+            this.MaximizeBox = false;
+            this.MinimizeBox = false;
+            this.Name = "SpectrumExportConfirmation";
+            this.ShowIcon = false;
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.Text = "SpectrumExportConfirmation";
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.TextBox tBox1;
+        private System.Windows.Forms.Button bt_Path;
+        private System.Windows.Forms.CheckBox cB_SpectrumConfirmation;
+        private System.Windows.Forms.Button bt_Export;
+    }
+}

+ 89 - 0
OTSIncAReportApp/1-UI/Control_Grids/SpectrumExportConfirmation.cs

@@ -0,0 +1,89 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace OTSIncAReportApp._1_UI.Control_Grids
+{
+    public partial class SpectrumExportConfirmation : Form
+    {
+        bool m_SpectrumConfirmation = false;
+        string m_savepath = "";
+        public bool SpectrumConfirmation
+        {
+            get
+            {
+                return m_SpectrumConfirmation;
+            }
+            set
+            {
+                m_SpectrumConfirmation = value;
+            }
+        }
+
+        public string FileName
+        {
+            get
+            {
+                return m_savepath;
+            }
+            set
+            {
+                m_savepath = value;
+            }
+        }
+
+        public SpectrumExportConfirmation()
+        {
+            InitializeComponent();
+        }
+
+        private void bt_Path_Click(object sender, EventArgs e)
+        {
+            //将所有的数据导出到EXCEL中
+            SaveFileDialog sfd = new SaveFileDialog();
+            sfd.Filter = "Excel File(*.xlsx)|*.xlsx";
+            //设置默认文件类型显示顺序
+            sfd.FilterIndex = 1;
+
+            //保存对话框是否记忆上次打开的目录
+            sfd.RestoreDirectory = true;
+            if (sfd.ShowDialog() == DialogResult.OK)
+            {
+                tBox1.Text = sfd.FileName;
+            }
+        }
+
+        private void cB_SpectrumConfirmation_CheckedChanged(object sender, EventArgs e)
+        {
+            if(cB_SpectrumConfirmation.Checked)
+            {
+                m_SpectrumConfirmation = true;
+            }
+            else
+            {
+                m_SpectrumConfirmation = false;
+            }
+        }
+
+        private void bt_Export_Click(object sender, EventArgs e)
+        {
+            if(tBox1.Text == "")
+            {
+                MessageBox.Show("save path can not be null!");
+            }
+            else
+            {
+                m_savepath = tBox1.Text;
+                this.DialogResult = DialogResult.OK;
+                this.Close();
+            }
+            
+        }
+    }
+}

+ 120 - 0
OTSIncAReportApp/1-UI/Control_Grids/SpectrumExportConfirmation.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 3 - 1
OTSIncAReportApp/1-UI/OTSDisplaySourceGridData/frmReportConditionChoose.cs

@@ -156,7 +156,9 @@ namespace OTSIncAReportApp
             //数据表类型
             List<string> list2 = new List<string>() { surveyResults, sampleMeasurementInformation, granularComponent, particleSizeDistribution, averageElementComposition };
 
-            if (m_rstDataMgr.m_RptConfigFile.Systype == DataOperation.Model.OTS_SysType_ID.IncA)
+            var resultinfo = m_rstDataMgr.ResultFilesList[m_rstDataMgr.GetWorkingResult()];
+            var Systype = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)(Dictionary<string, object>)resultinfo.ResultInfo["Sample"])["Members"])["MsrParams"])["SysType"].ToString();
+            if (Systype == "0:IncA")
             {
                 string[] aa = m_ReportApp.Text.Split('-');
                 List<string> listStd = new List<string>() { chineseStandard1, chineseStandard2, americanStandard, germanStandard };

+ 1 - 1
OTSIncAReportApp/1-UI/OTSTemplateDesigner/Export_NPOI_Excel.cs

@@ -163,7 +163,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 
             IClientAnchor anchor = sheet.GetRow(m_Excel_Row_CurrentNumber + row).GetCell(cell).Sheet.Workbook.GetCreationHelper().CreateClientAnchor();
 
-            anchor.AnchorType = (int)AnchorType.MoveDontResize;
+            anchor.AnchorType = AnchorType.MoveDontResize;
             int dx1 = 200;
             int dy1 = 50;
             //在单元格上的位置,不能居中就要这样弄了

+ 39 - 56
OTSIncAReportApp/1-UI/OTSTemplateDesigner/OTSReport_Export.Designer.cs

@@ -51,47 +51,42 @@
             // 
             // richTextBox1
             // 
-            this.richTextBox1.Location = new System.Drawing.Point(13, 53);
-            this.richTextBox1.Margin = new System.Windows.Forms.Padding(2);
+            this.richTextBox1.Location = new System.Drawing.Point(20, 80);
             this.richTextBox1.Name = "richTextBox1";
-            this.richTextBox1.Size = new System.Drawing.Size(455, 231);
+            this.richTextBox1.Size = new System.Drawing.Size(680, 344);
             this.richTextBox1.TabIndex = 60;
             this.richTextBox1.Text = "";
             // 
             // progressBar1
             // 
-            this.progressBar1.Location = new System.Drawing.Point(93, 293);
-            this.progressBar1.Margin = new System.Windows.Forms.Padding(2);
+            this.progressBar1.Location = new System.Drawing.Point(140, 440);
             this.progressBar1.Name = "progressBar1";
-            this.progressBar1.Size = new System.Drawing.Size(374, 15);
+            this.progressBar1.Size = new System.Drawing.Size(561, 22);
             this.progressBar1.TabIndex = 70;
             // 
             // label2
             // 
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(5, 293);
-            this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label2.Location = new System.Drawing.Point(8, 440);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(77, 12);
+            this.label2.Size = new System.Drawing.Size(116, 18);
             this.label2.TabIndex = 1004;
             this.label2.Text = "当前导出进度";
             // 
             // label3
             // 
             this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(11, 9);
-            this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label3.Location = new System.Drawing.Point(16, 14);
             this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(53, 12);
+            this.label3.Size = new System.Drawing.Size(80, 18);
             this.label3.TabIndex = 1001;
             this.label3.Text = "选择模板";
             // 
             // btn_exit
             // 
-            this.btn_exit.Location = new System.Drawing.Point(389, 319);
-            this.btn_exit.Margin = new System.Windows.Forms.Padding(2);
+            this.btn_exit.Location = new System.Drawing.Point(584, 478);
             this.btn_exit.Name = "btn_exit";
-            this.btn_exit.Size = new System.Drawing.Size(73, 27);
+            this.btn_exit.Size = new System.Drawing.Size(110, 40);
             this.btn_exit.TabIndex = 90;
             this.btn_exit.Text = "退  出";
             this.btn_exit.UseVisualStyleBackColor = true;
@@ -100,30 +95,27 @@
             // label1
             // 
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(11, 33);
-            this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label1.Location = new System.Drawing.Point(16, 50);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(53, 12);
+            this.label1.Size = new System.Drawing.Size(80, 18);
             this.label1.TabIndex = 1002;
             this.label1.Text = "保存路径";
             this.label1.Visible = false;
             // 
             // tb_lj
             // 
-            this.tb_lj.Location = new System.Drawing.Point(68, 30);
-            this.tb_lj.Margin = new System.Windows.Forms.Padding(2);
+            this.tb_lj.Location = new System.Drawing.Point(102, 45);
             this.tb_lj.Name = "tb_lj";
             this.tb_lj.ReadOnly = true;
-            this.tb_lj.Size = new System.Drawing.Size(285, 21);
+            this.tb_lj.Size = new System.Drawing.Size(426, 28);
             this.tb_lj.TabIndex = 30;
             this.tb_lj.Visible = false;
             // 
             // btn_selectPath
             // 
-            this.btn_selectPath.Location = new System.Drawing.Point(356, 29);
-            this.btn_selectPath.Margin = new System.Windows.Forms.Padding(2);
+            this.btn_selectPath.Location = new System.Drawing.Point(534, 44);
             this.btn_selectPath.Name = "btn_selectPath";
-            this.btn_selectPath.Size = new System.Drawing.Size(47, 20);
+            this.btn_selectPath.Size = new System.Drawing.Size(70, 30);
             this.btn_selectPath.TabIndex = 40;
             this.btn_selectPath.Text = "...";
             this.btn_selectPath.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -133,19 +125,17 @@
             // 
             // tb_mblj
             // 
-            this.tb_mblj.Location = new System.Drawing.Point(68, 6);
-            this.tb_mblj.Margin = new System.Windows.Forms.Padding(2);
+            this.tb_mblj.Location = new System.Drawing.Point(102, 9);
             this.tb_mblj.Name = "tb_mblj";
             this.tb_mblj.ReadOnly = true;
-            this.tb_mblj.Size = new System.Drawing.Size(285, 21);
+            this.tb_mblj.Size = new System.Drawing.Size(426, 28);
             this.tb_mblj.TabIndex = 0;
             // 
             // btn_openfilepath
             // 
-            this.btn_openfilepath.Location = new System.Drawing.Point(356, 4);
-            this.btn_openfilepath.Margin = new System.Windows.Forms.Padding(2);
+            this.btn_openfilepath.Location = new System.Drawing.Point(534, 6);
             this.btn_openfilepath.Name = "btn_openfilepath";
-            this.btn_openfilepath.Size = new System.Drawing.Size(47, 20);
+            this.btn_openfilepath.Size = new System.Drawing.Size(70, 30);
             this.btn_openfilepath.TabIndex = 10;
             this.btn_openfilepath.Text = "...";
             this.btn_openfilepath.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -154,10 +144,9 @@
             // 
             // btn_TempDes
             // 
-            this.btn_TempDes.Location = new System.Drawing.Point(407, 4);
-            this.btn_TempDes.Margin = new System.Windows.Forms.Padding(2);
+            this.btn_TempDes.Location = new System.Drawing.Point(610, 6);
             this.btn_TempDes.Name = "btn_TempDes";
-            this.btn_TempDes.Size = new System.Drawing.Size(65, 20);
+            this.btn_TempDes.Size = new System.Drawing.Size(98, 30);
             this.btn_TempDes.TabIndex = 20;
             this.btn_TempDes.Text = "导出编辑";
             this.btn_TempDes.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -167,10 +156,9 @@
             // label4
             // 
             this.label4.AutoSize = true;
-            this.label4.Location = new System.Drawing.Point(11, 33);
-            this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label4.Location = new System.Drawing.Point(16, 50);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(53, 12);
+            this.label4.Size = new System.Drawing.Size(80, 18);
             this.label4.TabIndex = 1003;
             this.label4.Text = "数 据 源";
             // 
@@ -178,26 +166,23 @@
             // 
             this.cbo_sjy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.cbo_sjy.FormattingEnabled = true;
-            this.cbo_sjy.Location = new System.Drawing.Point(68, 31);
-            this.cbo_sjy.Margin = new System.Windows.Forms.Padding(2);
+            this.cbo_sjy.Location = new System.Drawing.Point(102, 46);
             this.cbo_sjy.Name = "cbo_sjy";
-            this.cbo_sjy.Size = new System.Drawing.Size(285, 20);
+            this.cbo_sjy.Size = new System.Drawing.Size(426, 26);
             this.cbo_sjy.TabIndex = 50;
             // 
             // panel_container
             // 
-            this.panel_container.Location = new System.Drawing.Point(66, 188);
-            this.panel_container.Margin = new System.Windows.Forms.Padding(2);
+            this.panel_container.Location = new System.Drawing.Point(99, 282);
             this.panel_container.Name = "panel_container";
-            this.panel_container.Size = new System.Drawing.Size(17, 21);
+            this.panel_container.Size = new System.Drawing.Size(26, 32);
             this.panel_container.TabIndex = 5;
             // 
             // button3
             // 
-            this.button3.Location = new System.Drawing.Point(407, 29);
-            this.button3.Margin = new System.Windows.Forms.Padding(2);
+            this.button3.Location = new System.Drawing.Point(610, 44);
             this.button3.Name = "button3";
-            this.button3.Size = new System.Drawing.Size(65, 20);
+            this.button3.Size = new System.Drawing.Size(98, 30);
             this.button3.TabIndex = 40;
             this.button3.Text = "打开文件";
             this.button3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -207,10 +192,9 @@
             // 
             // btn_preview
             // 
-            this.btn_preview.Location = new System.Drawing.Point(312, 319);
-            this.btn_preview.Margin = new System.Windows.Forms.Padding(2);
+            this.btn_preview.Location = new System.Drawing.Point(468, 478);
             this.btn_preview.Name = "btn_preview";
-            this.btn_preview.Size = new System.Drawing.Size(73, 27);
+            this.btn_preview.Size = new System.Drawing.Size(110, 40);
             this.btn_preview.TabIndex = 80;
             this.btn_preview.Text = "打开报表";
             this.btn_preview.UseVisualStyleBackColor = true;
@@ -224,20 +208,20 @@
             // 
             // button7
             // 
-            this.button7.Location = new System.Drawing.Point(234, 319);
+            this.button7.Location = new System.Drawing.Point(351, 478);
+            this.button7.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.button7.Name = "button7";
-            this.button7.Size = new System.Drawing.Size(73, 27);
+            this.button7.Size = new System.Drawing.Size(110, 40);
             this.button7.TabIndex = 1008;
             this.button7.Text = "国标导出";
             this.button7.UseVisualStyleBackColor = true;
-            this.button7.Visible = false;
             this.button7.Click += new System.EventHandler(this.button7_Click);
             // 
             // OTSReport_Export
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(475, 350);
+            this.ClientSize = new System.Drawing.Size(704, 500);
             this.ControlBox = false;
             this.Controls.Add(this.button7);
             this.Controls.Add(this.cbo_sjy);
@@ -257,11 +241,10 @@
             this.Controls.Add(this.richTextBox1);
             this.Controls.Add(this.panel_container);
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
-            this.Margin = new System.Windows.Forms.Padding(2);
             this.MaximizeBox = false;
-            this.MaximumSize = new System.Drawing.Size(491, 389);
+            this.MaximumSize = new System.Drawing.Size(726, 556);
             this.MinimizeBox = false;
-            this.MinimumSize = new System.Drawing.Size(491, 389);
+            this.MinimumSize = new System.Drawing.Size(726, 556);
             this.Name = "OTSReport_Export";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
             this.Text = "报告程序输出界面";

+ 4 - 0
OTSIncAReportApp/App.config

@@ -40,6 +40,10 @@
         <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
         <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
       </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
+      </dependentAssembly>
     </assemblyBinding>
   </runtime>
   <entityFramework>

+ 22 - 19
OTSIncAReportApp/OTSIncAReportApp.csproj

@@ -161,6 +161,9 @@
     <Prefer32Bit>true</Prefer32Bit>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
+      <HintPath>..\packages\Portable.BouncyCastle.1.8.9\lib\net40\BouncyCastle.Crypto.dll</HintPath>
+    </Reference>
     <Reference Include="CefSharp, Version=51.0.0.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138, processorArchitecture=x86">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\Bin\x64\Debug\CefSharp.dll</HintPath>
@@ -179,9 +182,8 @@
     <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
       <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
     </Reference>
-    <Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\Bin\x64\Debug\ICSharpCode.SharpZipLib.dll</HintPath>
+    <Reference Include="ICSharpCode.SharpZipLib, Version=1.3.3.11, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
+      <HintPath>..\packages\SharpZipLib.1.3.3\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
     </Reference>
     <Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -206,25 +208,17 @@
     <Reference Include="NLog">
       <HintPath>..\Bin\x64\Debug\NLog.dll</HintPath>
     </Reference>
-    <Reference Include="NPOI, Version=2.1.3.1, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\OpenDll\WordApiDll\NPOI.dll</HintPath>
-      <Private>False</Private>
+    <Reference Include="NPOI, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
+      <HintPath>..\packages\NPOI.2.5.6\lib\net45\NPOI.dll</HintPath>
     </Reference>
-    <Reference Include="NPOI.OOXML, Version=2.1.3.1, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\OpenDll\WordApiDll\NPOI.OOXML.dll</HintPath>
-      <Private>False</Private>
+    <Reference Include="NPOI.OOXML, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
+      <HintPath>..\packages\NPOI.2.5.6\lib\net45\NPOI.OOXML.dll</HintPath>
     </Reference>
-    <Reference Include="NPOI.OpenXml4Net, Version=2.1.3.1, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\OpenDll\WordApiDll\NPOI.OpenXml4Net.dll</HintPath>
-      <Private>False</Private>
+    <Reference Include="NPOI.OpenXml4Net, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
+      <HintPath>..\packages\NPOI.2.5.6\lib\net45\NPOI.OpenXml4Net.dll</HintPath>
     </Reference>
-    <Reference Include="NPOI.OpenXmlFormats, Version=2.1.3.1, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\OpenDll\WordApiDll\NPOI.OpenXmlFormats.dll</HintPath>
-      <Private>False</Private>
+    <Reference Include="NPOI.OpenXmlFormats, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
+      <HintPath>..\packages\NPOI.2.5.6\lib\net45\NPOI.OpenXmlFormats.dll</HintPath>
     </Reference>
     <Reference Include="office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -300,6 +294,12 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="1-UI\Control_Grids\SpectrumExportConfirmation.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="1-UI\Control_Grids\SpectrumExportConfirmation.Designer.cs">
+      <DependentUpon>SpectrumExportConfirmation.cs</DependentUpon>
+    </Compile>
     <Compile Include="1-UI\ElementSubscript.cs" />
     <Compile Include="1-UI\frmCharts.cs">
       <SubType>Form</SubType>
@@ -632,6 +632,9 @@
     <EmbeddedResource Include="1-UI\Control_Grids\ResultGrid.resx">
       <DependentUpon>ResultGrid.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="1-UI\Control_Grids\SpectrumExportConfirmation.resx">
+      <DependentUpon>SpectrumExportConfirmation.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="1-UI\frmCharts.resx">
       <DependentUpon>frmCharts.cs</DependentUpon>
     </EmbeddedResource>

+ 3 - 0
OTSIncAReportApp/packages.config

@@ -1,9 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="EntityFramework" version="6.4.4" targetFramework="net472" />
+  <package id="NPOI" version="2.5.6" targetFramework="net462" />
   <package id="OpenCvSharp4" version="4.5.5.20211231" targetFramework="net462" />
   <package id="OpenCvSharp4.runtime.win" version="4.5.5.20211231" targetFramework="net462" />
   <package id="OpenCvSharp4.Windows" version="4.5.5.20211231" targetFramework="net462" />
+  <package id="Portable.BouncyCastle" version="1.8.9" targetFramework="net462" />
+  <package id="SharpZipLib" version="1.3.3" targetFramework="net462" />
   <package id="System.Buffers" version="4.5.1" targetFramework="net462" />
   <package id="System.Collections" version="4.3.0" targetFramework="net472" />
   <package id="System.Data.SQLite.EF6" version="1.0.115.0" targetFramework="net472" />