/// <summary> /// 输出 /// </summary> private void btnExport() { try { SaveFileDialog sF = new SaveFileDialog(); sF.DefaultExt = "xls"; sF.FileName = this.Text; sF.Filter = "Excel文件(*.xls)|*.xls|所有文件(*.*)|*.*"; DialogResult dRes = sF.ShowDialog(); if (DialogResult.OK == dRes) { GridView1.ExportToXls(sF.FileName); MessageBox.Show("导出Excel成功\n\t路径:" + sF.FileName); } } catch (Exception ee) { MessageBox.Show(ee.Message); } }