private void btn_exportExcel_Click(object sender, EventArgs e) { string pathsave = ""; System.Windows.Forms.SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Title = "Browse Excel Files"; saveFileDialog.DefaultExt = "Excel"; saveFileDialog.Filter = "Excel files (*.xls)|*.xls"; saveFileDialog.CheckPathExists = true; if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { pathsave = saveFileDialog.FileName; saveFileDialog.RestoreDirectory = true; if (dtgv_ExportSummary.Rows.Count > 0) { Class.ToolSupport toolSupport = new Class.ToolSupport(); toolSupport.dtgvExport2Excel(dtgv_ExportSummary, pathsave); } } }
private void Btn_ExportExcel_Click(object sender, EventArgs e) { Class.ToolSupport toolSupport = new Class.ToolSupport(); toolSupport.dtgvExport2Excel(dtgv_material, @"C:\Users\Tech-Link\Downloads\test3.xls"); }