public void AutoRun() { using (FlexCelReport ordersReport = SharedData.CreateReport()) { ordersReport.SetValue("Date", DateTime.Now); ordersReport.SetUserFunction("Orders", new OrdersImp(SharedData.GetOrders())); string DataPath = Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), ".."), "..") + Path.DirectorySeparatorChar; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { ordersReport.Run(DataPath + "User Defined Functions.template.xls", saveFileDialog1.FileName); if (MessageBox.Show("Do you want to open the generated file?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes) { Process.Start(saveFileDialog1.FileName); } } } }