فهرست منبع

是否导出谱峰图

cxs 3 سال پیش
والد
کامیت
5ce76a0517
2فایلهای تغییر یافته به همراه76 افزوده شده و 62 حذف شده
  1. 67 62
      OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs
  2. 9 0
      OTSIncAReportApp/OTSIncAReportApp.csproj

+ 67 - 62
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs

@@ -1802,14 +1802,16 @@ namespace OTSIncAReportGrids
 
         private void EXCELToolStripMenuItem_Click(object sender, EventArgs e)
         {
-            //将所有的数据导出到EXCEL中
-            SaveFileDialog sfd = new SaveFileDialog();
-            sfd.Filter = "Excel File(*.xlsx)|*.xlsx";
-            //设置默认文件类型显示顺序
-            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)
             {
@@ -1822,8 +1824,7 @@ namespace OTSIncAReportGrids
                 fs.Close();
 
                 sheet = workbook.CreateSheet("Particles");//创建工作表
-                ISheet sheet3;
-                sheet3 = workbook.CreateSheet("Peak spectrum");
+                
 
                 //创建表格边框样式风格
                 ICellStyle cellStyle = workbook.CreateCellStyle();
@@ -1965,63 +1966,67 @@ namespace OTSIncAReportGrids
                     }
                 }
 
-                
-                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++)
+                if (sfd.SpectrumConfirmation)
                 {
-                    row = sheet3.CreateRow(j + 2);
-                    row.Height = 120 * 20;
+                    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(j + 1);
+                    cell.SetCellValue("rowid");
+
                     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);
+                    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);

+ 9 - 0
OTSIncAReportApp/OTSIncAReportApp.csproj

@@ -294,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>
@@ -626,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>