C#将gridview导出Excel表方法

将gridview导出Excel表方法

 #region 导出Excel表方法
        /// <summary>
        /// 导出Excel表方法
        /// </summary>
        /// <param name="gridview">当前gridview表</param>
        public static void ExportExcelMethod(DevExpress.XtraGrid.GridControl gridview)
        {
            SaveFileDialog sf = new SaveFileDialog();
            sf.RestoreDirectory = true;
            sf.Filter = " Excel files(*.xls)|*.xls|All files(*.*)|*.*";
            if (sf.ShowDialog() == DialogResult.OK)
            {
                string localFilePath = sf.FileName.ToString();//获得文件路径  
                gridview.ExportToXls(localFilePath);
            }
        }
已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页