private void btnSample_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Excel file |*.xls;*.xlsx;*.csv"; if (sfd.ShowDialog() == DialogResult.OK) { const string MyFileName = "sample.csv"; string execPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); var filePath = Path.Combine(execPath, MyFileName); Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.Workbook book = app.Workbooks.Open(filePath); book.SaveAs(sfd.FileName); //Save book.Close(); } }
book.SaveAs(sfd.FileName);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)