|
@@ -1804,15 +1804,6 @@ namespace OTSIncAReportGrids
|
|
|
private void EXCELToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
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;
|
|
|
|
|
|
if (sfd.ShowDialog() == DialogResult.OK)
|
|
|
{
|
|
@@ -1897,13 +1888,6 @@ 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
|
|
|
{
|
|
|
//非图像列
|
|
@@ -2000,33 +1984,6 @@ namespace OTSIncAReportGrids
|
|
|
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进行保存
|
|
@@ -2042,25 +1999,13 @@ 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>(); //折线图
|
|
|
|
|
@@ -2079,8 +2024,7 @@ namespace OTSIncAReportGrids
|
|
|
doubles[i] = i;
|
|
|
}
|
|
|
IChartDataSource<double> xs = DataSources.FromArray(doubles);
|
|
|
- //IChartDataSource<double> ys = DataSources.FromArray(doubles);
|
|
|
-
|
|
|
+
|
|
|
//数据系列
|
|
|
var s1 = data.AddSeries(xs, ys);
|
|
|
|