private void Form1_Shown(object sender, EventArgs e) { Excel.Application app = null; try { Settings.Default.PerformanceTrace.Alert += new PerformanceTrace.PerformanceAlertEventHandler(PerformanceTrace_Alert); Settings.Default.PerformanceTrace["ExcelApi"].Enabled = true; Settings.Default.PerformanceTrace["ExcelApi"].IntervalMS = 0; //Settings.Default.PerformanceTrace["ExcelApi", "Application", "DisplayAlerts"].Enabled = true; //Settings.Default.PerformanceTrace["ExcelApi", "Application", "DisplayAlerts"].IntervalMS = 0; app = new Excel.Application(); NOTools.Utils.CommonUtils utils = new NOTools.Utils.CommonUtils(app, typeof(Form1).Assembly); app.DisplayAlerts = false; utils.Dialog.SuppressOnAutomation = false; utils.Dialog.SuppressOnHide = false; utils.Dialog.ShowDiagnostics(true); } catch (Exception exception) { Console.WriteLine(exception.ToString()); } finally { app.Quit(); app.Dispose(); Close(); } }
private void Form1_Shown(object sender, EventArgs e) { Excel.Application app = null; try { Settings.Default.PerformanceTrace.Alert += new PerformanceTrace.PerformanceAlertEventHandler(PerformanceTrace_Alert); Settings.Default.PerformanceTrace["ExcelApi"].Enabled = true; Settings.Default.PerformanceTrace["ExcelApi"].IntervalMS = 0; //Settings.Default.PerformanceTrace["ExcelApi", "Application", "DisplayAlerts"].Enabled = true; //Settings.Default.PerformanceTrace["ExcelApi", "Application", "DisplayAlerts"].IntervalMS = 0; app = new Excel.Application(); NOTools.Utils.CommonUtils utils = new NOTools.Utils.CommonUtils(app, typeof(Form1).Assembly); app.DisplayAlerts = false; utils.Dialog.SuppressOnAutomation = false; utils.Dialog.SuppressOnHide = false; utils.Dialog.ShowDiagnostics(true); } catch (Exception exception) { Console.WriteLine(exception.ToString()); } finally { app.Quit(); app.Dispose(); Close(); } }