|
@@ -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._1_UI;
|
|
|
using OTSIncAReportApp.DataOperation.DataAccess;
|
|
@@ -22,6 +25,7 @@ using System.Reflection;
|
|
|
using System.Threading;
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
+
|
|
|
namespace OTSIncAReportGrids
|
|
|
{
|
|
|
public partial class ParticlesGridDevidePage : UserControl
|
|
@@ -86,10 +90,11 @@ namespace OTSIncAReportGrids
|
|
|
frmReportConditionChoose m_condition;
|
|
|
FieldData fieldData;
|
|
|
DataTable particlesAll;
|
|
|
+ DataTable particles;
|
|
|
ParticleData Particledata;
|
|
|
UserLibraryData userLibrary;
|
|
|
DataTable userLibraryData;
|
|
|
- NLog.Logger log= NLog.LogManager.GetCurrentClassLogger();
|
|
|
+ NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
#region 分页器相关
|
|
|
|
|
@@ -176,15 +181,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];
|
|
|
}
|
|
@@ -212,14 +217,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;
|
|
|
}
|
|
@@ -240,12 +245,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)
|
|
|
{
|
|
@@ -311,7 +316,7 @@ 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, "", "", "", "", "");
|
|
|
}
|
|
@@ -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 加载进度条进度部份结束
|
|
@@ -744,7 +749,7 @@ namespace OTSIncAReportGrids
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- if(PageSize==-1)
|
|
|
+ if (PageSize == -1)
|
|
|
{
|
|
|
PageSize = particlesAll.Rows.Count;
|
|
|
}
|
|
@@ -754,7 +759,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)
|
|
@@ -893,7 +898,7 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
#region 加载进度条进度部份结束
|
|
|
//加载完成设置鼠标为默认
|
|
@@ -1120,7 +1125,7 @@ namespace OTSIncAReportGrids
|
|
|
if (m_OTSIncAReportGridsFun.m_SEMConnectionState == true)
|
|
|
{
|
|
|
m_OTSIncAReportGridsFun.MoveSemToPointXY_ForParticlesGrid(sem_point.X, sem_point.Y);
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
Thread.Sleep(1500);
|
|
@@ -1328,7 +1333,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;
|
|
@@ -1350,7 +1355,7 @@ namespace OTSIncAReportGrids
|
|
|
{
|
|
|
dmin = Convert.ToDouble(min);
|
|
|
}
|
|
|
- if(dmin<=dmax)
|
|
|
+ if (dmin <= dmax)
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
@@ -1371,7 +1376,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;
|
|
|
}
|
|
@@ -1409,7 +1414,7 @@ namespace OTSIncAReportGrids
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(tbx_DmaxMin.Text))
|
|
|
{
|
|
@@ -1419,7 +1424,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;
|
|
|
}
|
|
@@ -1438,7 +1443,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;
|
|
|
}
|
|
@@ -1557,7 +1562,7 @@ namespace OTSIncAReportGrids
|
|
|
lnkNext.Enabled = false;
|
|
|
lnkLast.Enabled = false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
private void SetFormCtrEnabled()
|
|
|
{
|
|
@@ -1633,16 +1638,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());
|
|
|
}
|
|
@@ -1687,7 +1692,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++)
|
|
|
{
|
|
@@ -1723,7 +1728,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)
|
|
|
{
|
|
@@ -1743,7 +1748,7 @@ namespace OTSIncAReportGrids
|
|
|
img.Dispose();
|
|
|
img = null;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
//循环将颗粒,进行标记到bitmap图上
|
|
|
DataRow[] drlist = dt_AllParticle.Select(dt_FIeld.Rows[i]["fieldid"].ToString());
|
|
|
if (drlist.Count() > 0)
|
|
@@ -1772,7 +1777,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));
|
|
|
|
|
@@ -1798,19 +1803,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文件
|
|
@@ -1818,6 +1825,7 @@ namespace OTSIncAReportGrids
|
|
|
fs.Close();
|
|
|
|
|
|
sheet = workbook.CreateSheet("Particles");//创建工作表
|
|
|
+
|
|
|
|
|
|
//创建表格边框样式风格
|
|
|
ICellStyle cellStyle = workbook.CreateCellStyle();
|
|
@@ -1889,11 +1897,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);
|
|
|
}
|
|
@@ -1907,10 +1922,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);
|
|
@@ -1926,11 +2043,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>
|
|
@@ -1955,7 +2112,7 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
private void ToolStripMenuItem_Delete_Particle_Click(object sender, EventArgs e)
|
|
|
{
|
|
@@ -2024,8 +2181,8 @@ namespace OTSIncAReportGrids
|
|
|
frmReMeasure.TopMost = true;//设置置顶
|
|
|
frmReMeasure.ShowDialog();
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|