private void createExcel_button_Click(object sender, EventArgs e) { string xlTemplatePath = @"C:\steven\DrwinMain2017\DRWIN_APP\MAIN-Steven\HssUtility\Ref_DLLs\XML Templates\Excel\"; DataSet ds = new DataSet(); DataTable dt = ds.Tables.Add("Security"); dt.Columns.Add("Security(CUSIP) Exist"); dt.Columns.Add("Depo/FirstFiler/Ratio"); dt.Columns.Add("Name/TickerSymbol"); dt.Columns.Add("Action"); string[] trueFalse_arr = { "True", "False" }; string[] comp_arr = { "Same", "Different", "Missing" }; foreach (string sec in trueFalse_arr) { foreach (string dfr in comp_arr) { foreach (string nt in comp_arr) { DataRow row = dt.Rows.Add(); row["Security(CUSIP) Exist"] = sec; row["Depo/FirstFiler/Ratio"] = dfr; row["Name/TickerSymbol"] = nt; } } } SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Excel|*.xlsx"; if (sfd.ShowDialog() == DialogResult.OK) { HssRawExcel hre = new HssRawExcel(); hre.Create_Excel_fromDS(ds, sfd.FileName, xlTemplatePath); MessageBox.Show("Done"); } }
public void Run() { if (string.IsNullOrEmpty(this.exportPath)) { Console.WriteLine("ForThread error 0: no export path"); return; } DTC_Solicitation dtcSol = new DTC_Solicitation(); dtcSol.statusInfo = statusInfo; DataTable dt = dtcSol.Get_report_DT(); //ViewDataForm vdf = new ViewDataForm(); //vdf.Show(); //vdf.Set_grid_dataSource(dt); this.statusInfo.status = "Create_Excel_fromDS"; HssRawExcel hre = new HssRawExcel(); hre.hLog = this.statusInfo; DataSet ds = new DataSet(); ds.Tables.Add(dt); dt.TableName = "Business Development"; hre.Create_Excel_fromDS(ds, this.exportPath); this.statusInfo.status = "Finished"; this.statusInfo.IsActive = false; MessageBox.Show("Done"); Thread th = new Thread(this.ClearMemory); th.Start(); }