public void AutoSave() { DataTable dt = new DataTable("ExcelTable"); Excel.ExcelUtlity2 obj = new Excel.ExcelUtlity2(); DataView dv = new DataView(Global.Instance.OrdetTable); dv.RowFilter = "status = 'Traded'"; dv.ToTable("ExcelTable"); obj.WriteDataTableToExcel(Global.Instance.OrdetTable, "Excel Report", Application.StartupPath + Path.DirectorySeparatorChar + System.DateTime.Now.Date.ToString("dddd, MMMM d, yyyy") + " Default.xlsx", "Details"); }
private void frmGenOrderBook_FormClosing(object sender, FormClosingEventArgs e) { DataTable dt = new DataTable("ExcelTable"); Excel.ExcelUtlity2 obj = new Excel.ExcelUtlity2(); DataView dv = new DataView(Global.Instance.OrdetTable); dv.RowFilter = "status = 'Traded'"; dv.ToTable("ExcelTable"); obj.WriteDataTableToExcel(Global.Instance.OrdetTable, "Excel Report", Application.StartupPath + Path.DirectorySeparatorChar + System.DateTime.Now.Date.ToString("dddd, MMMM d, yyyy") + " Default.xlsx", "Details"); Settings.Default.Window_LocationOBook = this.Location; if (this.WindowState == FormWindowState.Normal) { Settings.Default.Window_SizeOBook = this.Size; } else { Settings.Default.Window_SizeOBook = this.RestoreBounds.Size; } // Save settings Settings.Default.Save(); e.Cancel = true; this.Hide(); }