private void Click_EXCEL_EXPORT_Button() { try { DataTable dt = this.dtDataSource.Copy(); if (dt.Columns.Contains(Definition.CHART_COLUMN.TIME2)) { dt.Columns.Remove(Definition.CHART_COLUMN.TIME2); } this.bSpread1.ActiveSheet.RowCount = 0; this.bSpread1.ActiveSheet.ColumnCount = 0; this.bSpread1.ClearHead(); this.bSpread1.AddHeadComplete(); this.bSpread1.UseSpreadEdit = false; this.bSpread1.AutoGenerateColumns = true; this.bSpread1.DataSource = dt; this.bSpread1_Sheet1.SheetName = this.Name; this.bSpread1.Export(false); } catch (Exception ex) { MSGHandler.DisplayMessage(MSGType.Error, ex.ToString()); EESUtil.DebugLog("BTeeChart", "ExportDataForExcel", ex); } }
private void Chart_MouseLeave(object sender, EventArgs e) { try { BaseChart baseChart = FindSPCChart((Control)sender); Annotation ann; if (baseChart is DefaultChart) { for (int i = 0; i < baseChart.SPCChart.Chart.Tools.Count; i++) { if (baseChart.SPCChart.Chart.Tools[i].GetType() == typeof(Annotation)) { ann = baseChart.SPCChart.Chart.Tools[i] as Annotation; if (ann.Active) { ann.Active = false; } } } } } catch (Exception ex) { EESUtil.DebugLog(ex); } }
private void SPCChart_ClickSeries(object sender, Series s, int valueIndex, MouseEventArgs e) { try { SeriesInfo seriesInfo = ((ChartSeriesGroup)sender).GetSeriesInfo(s); if (seriesInfo == null || !seriesInfo.SeriesData.Columns.Contains(CommonChart.COLUMN_NAME_SEQ_INDEX)) { return; } #region ToolTip BaseChart baseChart = FindSPCChart((Control)sender); if (baseChart is DefaultChart) { this._chartInfomationUI.InfomationSpreadReSet(this._dataManager.RawDataTable.Rows[valueIndex]); _valueIndex = valueIndex; string strCol = s.Title; if (strCol == Definition.CHART_COLUMN.USL_LSL) { strCol = Definition.CHART_COLUMN.USL; } else if (strCol == Definition.CHART_COLUMN.UCL_LCL) { strCol = Definition.CHART_COLUMN.UCL; } string strValue = seriesInfo.SeriesData.Rows[valueIndex][strCol].ToString(); for (int i = 0; i < baseChart.SPCChart.Chart.Tools.Count; i++) { if (baseChart.SPCChart.Chart.Tools[i].GetType() == typeof(Steema.TeeChart.Tools.Annotation)) { Annotation ann = (Annotation)baseChart.SPCChart.Chart.Tools[i]; this._chartUtil.ShowAnnotate(baseChart.SPCChart.Chart, ann, e.X, e.Y, CreateToolTipString(strCol, strValue, valueIndex, baseChart.NAME)); break; } } } #endregion } catch (Exception ex) { EESUtil.DebugLog(ex); _valueIndex = -1; } }
private void Click_EXCEL_EXPORT_Button() { try { DataTable dt = this._dtChartData.Copy(); if (dt.Columns.Contains(Definition.CHART_COLUMN.TIME2)) { dt.Columns.Remove(Definition.CHART_COLUMN.TIME2); } if (dt.Columns.Contains("TIME")) { dt.Columns.Remove("TIME"); } if (dt.Columns.Contains(CommonChart.COLUMN_NAME_SEQ_INDEX)) { dt.Columns.Remove(CommonChart.COLUMN_NAME_SEQ_INDEX); } this.bSpread1.ActiveSheet.RowCount = 0; this.bSpread1.ActiveSheet.ColumnCount = 0; this.bSpread1.ClearHead(); this.bSpread1.AddHeadComplete(); this.bSpread1.UseSpreadEdit = false; this.bSpread1.AutoGenerateColumns = true; this.bSpread1.DataSource = dt; this.bSpread1_Sheet1.SheetName = this.bTChrt_RawData.Name; string file = ""; bool bProtect = this.bSpread1.ActiveSheet.Protect; this.bSpread1.ActiveSheet.Protect = false; SaveFileDialog openDlg = new SaveFileDialog(); openDlg.Filter = "Excel Files (*.xls)|*.xls"; openDlg.FileName = ""; openDlg.DefaultExt = ".xls"; openDlg.CheckFileExists = false; openDlg.CheckPathExists = true; DialogResult res = openDlg.ShowDialog(); if (res != DialogResult.OK) { return; } file = openDlg.FileName; FarPoint.Win.Spread.SheetView spread_Sheet1 = new FarPoint.Win.Spread.SheetView(); spread_Sheet1.SheetName = "_ExcelExportSheet"; FarPoint.Win.Spread.FpSpread spread = new FarPoint.Win.Spread.FpSpread(); spread.Sheets.Add(spread_Sheet1); spread_Sheet1.Visible = true; spread.ActiveSheet = spread_Sheet1; byte[] buffer = null; System.IO.MemoryStream stream = null; this.bSpread1.SetFilterVisible(false); try { stream = new System.IO.MemoryStream(); this.bSpread1.Save(stream, false); buffer = stream.ToArray(); stream.Close(); } catch (Exception ex) { throw ex; } finally { if (stream != null) { stream.Dispose(); stream = null; } } stream = new System.IO.MemoryStream(buffer); spread.Open(stream); if (stream != null) { stream.Dispose(); stream = null; } for (int i = spread.ActiveSheet.Columns.Count - 1; i >= 0; i--) { if (!spread.ActiveSheet.Columns[i].Visible) { spread.ActiveSheet.Columns[i].Remove(); } } spread.SaveExcel(file, FarPoint.Win.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly); this.bSpread1.ActiveSheet.Protect = bProtect; string strMessage = "It was saved successfully. Do you open saved file?"; DialogResult result = MessageBox.Show(strMessage, "Open", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Applications\EXCEL.EXE"); if (key == null) { MSGHandler.DisplayMessage(MSGType.Error, "SPC_INFO_NEED_MS_OFFICE", null, null); } else { System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo.FileName = file; process.Start(); } } //this.bSpread1.Export(false); } catch (Exception ex) { MSGHandler.DisplayMessage(MSGType.Error, ex.ToString()); EESUtil.DebugLog("BTeeChart", "ExportDataForExcel", ex); } }
private void AddModuleNode(TreeNode tnCurrent, string dcpRawid) { try { if (tnCurrent.Nodes.Count > 0) { return; } LinkedList llstData = new LinkedList(); llstData.Add(Definition.DynamicCondition_Condition_key.LINE_RAWID, this.LineRawid); llstData.Add(Definition.DynamicCondition_Condition_key.AREA_RAWID, this.AreaRawid); llstData.Add(Definition.DynamicCondition_Condition_key.EQP_ID, this.EqpID); llstData.Add(Definition.DynamicCondition_Condition_key.DCP_ID, this.DcpID); llstData.Add(Definition.DynamicCondition_Condition_key.MODULE_ID, this.EqpID); byte[] baData = llstData.GetSerialData(); DataSet ds = _wsSPC.GetModuleByEQP(baData); if (ds == null || ds.Tables.Count <= 0) { return; } for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string sModule = ds.Tables[0].Rows[i][Definition.DynamicCondition_Condition_key.ALIAS].ToString(); string sModuleID = ds.Tables[0].Rows[i][Definition.DynamicCondition_Condition_key.MODULE_ID].ToString(); string sParentModuleID = ds.Tables[0].Rows[i]["parent_moduleid"].ToString(); string sRawID = ds.Tables[0].Rows[i][Definition.DynamicCondition_Condition_key.RAWID].ToString(); if (sParentModuleID == string.Empty) { _sMainModuleRawid = sModuleID; } BTreeNode btn = TreeDCUtil.CreateBTreeNode(Definition.DynamicCondition_Search_key.MODULE, sModuleID, sModule); btn.IsVisibleCheckBox = this.IsShowCheck; btn.IsFolder = false; btn.IsVisibleNodeType = true; btn.ImageIndexList.Add((int)ImageLoader.TREE_IMAGE_INDEX.MODULE); btn.ImageIndex = (int)ImageLoader.TREE_IMAGE_INDEX.MODULE; DCValueOfTree dcValue = TreeDCUtil.GetDCValue(btn); dcValue.AdditionalValue.Add(Definition.DynamicCondition_Search_key.ADDTIONALVALUEDATA, sRawID); dcValue.Tag = sModuleID; if (this.IsLastNode) { if (_sMainModuleRawid != sModule) { if (llstData.Contains(Definition.DynamicCondition_Condition_key.MODULE_ID)) { llstData[Definition.DynamicCondition_Condition_key.MODULE_ID] = sModuleID; } else { llstData.Add(Definition.DynamicCondition_Condition_key.MODULE_ID, sModuleID); } byte[] data = llstData.GetSerialData(); DataSet dsSubModule = _wsSPC.GetSubModuleByEQP(data); if (dsSubModule.Tables.Count > 0 && dsSubModule.Tables[0].Rows.Count > 0) { btn.Nodes.Add(BTreeView.CreateDummyNode()); } } } else { btn.Nodes.Add(BTreeView.CreateDummyNode()); } tnCurrent.Nodes.Add(btn); } } catch (Exception ex) { EESUtil.DebugLog(ex); } }