将dev gridControl表中原形数据导出到excel功能写法
2016-02-25 10:01
447 查看
不废话,直接上图上代码
private void btnToXls_Click(object sender, EventArgs e)
{
SaveFileDialog fileDialog = new SaveFileDialog();
fileDialog.Title = "导出Excel";
fileDialog.Filter = "Excel文件(*.xls)|*.xls";
DialogResult dialogResult = fileDialog.ShowDialog(this);
if (dialogResult == DialogResult.OK)
{
DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions();
gridControl1.ExportToXls(fileDialog.FileName);
DevExpress.XtraEditors.XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void btnToXls_Click(object sender, EventArgs e)
{
SaveFileDialog fileDialog = new SaveFileDialog();
fileDialog.Title = "导出Excel";
fileDialog.Filter = "Excel文件(*.xls)|*.xls";
DialogResult dialogResult = fileDialog.ShowDialog(this);
if (dialogResult == DialogResult.OK)
{
DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions();
gridControl1.ExportToXls(fileDialog.FileName);
DevExpress.XtraEditors.XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
相关文章推荐
- PL/SQL Dev连接Oracle弹出空白提示框的解决方法分享
- DevExpress实现GridControl同步列头checkbox与列中checkbox状态
- DevExpress实现GridControl列头绘制Checkbox的方法
- DevExpress中GridControl列转义的实现方法
- DevExpress实现GridControl单元格编辑验证的方法
- DevExpress实现自定义GridControl中按钮文字内容的方法
- DevExpress实现GridControl显示Gif动画的方法
- linux dev 常见特殊设备介绍与应用(loop,null,zero,full,random)
- DevExpress实现GridControl删除所有行的方法
- Dev-Guide_Android Basics_What is Android?
- Dev Guide_Android Basics_Application Fundamenta
- >/dev/null 2>&1和&>/dev/null.的区别问题
- 解决 /dev/null is not a character device! 问题
- crontab 报错解决办法
- linux tmpfs与/dev/shm探讨及其应用
- 黑洞
- PHP Paypal IPN Integration Class
- 最新版ActivePerl Pro Studio(即:Komodo IDE、Perl Dev ...
- 应大家的索取要求,提供Perl Dev Kit与Komodo IDE注册机
- 关于之前Komodo IDE、Perl Dev Kit注册问题补充