|
@@ -85,6 +85,7 @@ namespace OTSIncAReportGrids
|
|
|
frmReportConditionChoose m_condition;
|
|
|
FieldData fieldData;
|
|
|
DataTable particlesAll;
|
|
|
+ DataTable particles;
|
|
|
ParticleData Particledata;
|
|
|
UserLibraryData userLibrary;
|
|
|
DataTable userLibraryData;
|
|
@@ -731,7 +732,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)
|
|
@@ -1862,18 +1863,10 @@ namespace OTSIncAReportGrids
|
|
|
|
|
|
private void EXCELToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- //将所有的数据导出到EXCEL中
|
|
|
- SaveFileDialog sfd = new SaveFileDialog();
|
|
|
- sfd.Filter = "Excel File(*.xls)|*.xls";
|
|
|
- //设置默认文件类型显示顺序
|
|
|
- sfd.FilterIndex = 1;
|
|
|
-
|
|
|
- //保存对话框是否记忆上次打开的目录
|
|
|
- sfd.RestoreDirectory = true;
|
|
|
+ OTSIncAReportApp._1_UI.Control_Grids.SpectrumExportConfirmation sfd = new OTSIncAReportApp._1_UI.Control_Grids.SpectrumExportConfirmation();
|
|
|
|
|
|
if (sfd.ShowDialog() == DialogResult.OK)
|
|
|
{
|
|
|
- Cursor = Cursors.WaitCursor;
|
|
|
//IWorkbook workbook = new HSSFWorkbook(); //用于创建.xls office2003开始以前的
|
|
|
IWorkbook workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(); //用于创建.xlsx office2007开始以后的
|
|
|
ISheet sheet;
|
|
@@ -1904,13 +1897,14 @@ namespace OTSIncAReportGrids
|
|
|
|
|
|
//设置颗粒名列宽
|
|
|
sheet.SetColumnWidth(1, 30 * 256);//夹杂物名列宽
|
|
|
- sheet.SetColumnWidth(2, 3 * 256);//图像列宽
|
|
|
+ sheet.SetColumnWidth(2, 7 * 256);//图像列宽
|
|
|
|
|
|
IRow row;
|
|
|
ICell cell;
|
|
|
|
|
|
//插入表头
|
|
|
row = sheet.CreateRow(1);//从第15行添加一行
|
|
|
+ row.Height = 30 * 20;
|
|
|
for (int i_cell = 0; i_cell < dgV_ParticlesDevidePage.Columns.Count; i_cell++)
|
|
|
{
|
|
|
cell = row.CreateCell(i_cell);
|
|
@@ -1924,6 +1918,7 @@ namespace OTSIncAReportGrids
|
|
|
for (int i_row = 0; i_row < dgV_ParticlesDevidePage.Rows.Count; i_row++)
|
|
|
{
|
|
|
row = sheet.CreateRow(2 + i_row);
|
|
|
+ row.Height = 45 * 20;
|
|
|
for (int i_cell = 0; i_cell < dgV_ParticlesDevidePage.Columns.Count; i_cell++)
|
|
|
{
|
|
|
cell = row.CreateCell(i_cell);
|
|
@@ -1971,10 +1966,23 @@ 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));
|
|
|
|
|
@@ -2028,9 +2036,9 @@ namespace OTSIncAReportGrids
|
|
|
cell = row.CreateCell(0);
|
|
|
cell.CellStyle = cellStyle;
|
|
|
cell.SetCellValue(j + 1);
|
|
|
- row.CreateCell(1);
|
|
|
- row.CreateCell(2);
|
|
|
- row.CreateCell(3);
|
|
|
+ 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开始
|
|
@@ -2051,7 +2059,6 @@ namespace OTSIncAReportGrids
|
|
|
//打开刚才导出的文件
|
|
|
System.Diagnostics.Process.Start(sfd.FileName);
|
|
|
}
|
|
|
- Cursor = Cursors.Default;
|
|
|
}
|
|
|
}
|
|
|
|