DevExpress gridControl导出

示例

            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.Filter = "Xlsx|*.xlsx|Text(*.txt)|*.txt";
            if (saveFileDialog.ShowDialog() != DialogResult.OK)
                return;
            bool flag = true;
            string fileName = saveFileDialog.FileName;
            switch (saveFileDialog.FilterIndex)
            {
                case 1:
                    this.gridControl.ExportToXlsx(fileName);
                    break;
                case 2:
                    this.gridControl.ExportToText(fileName);
                    break;
            }
            if (flag)
            {
                XMessageBox.Information("导出成功!");
            }
            else
            {
                XMessageBox.Information("导出失败!");
            }

 

posted @ 2023-03-01 11:05  恋上微笑的天使  阅读(75)  评论(0)    收藏  举报