WinForm------如何将GridControl数据导出到Excel
转载:
http://www.cnblogs.com/xiaofengfeng/archive/2011/11/22/2258906.html
Gridcontrol中的BandedGridView导出多层行头
转载:
http://www.cnblogs.com/huldy520/p/5611736.html
代码:
protected virtual void ExportToExcel(Object grid)
{
//EditorContainer定义GridControl之类的容器
SaveFileDialog dialog = new SaveFileDialog
{
Title = "导出Excel",
Filter = "Excel文件(*.xls)|*.xls"
};
if (dialog.ShowDialog(this) == DialogResult.OK)
{
//XlsExportOptions
XlsExportOptionsEx options = new XlsExportOptionsEx();
if (grid is GridControl)
{
(grid as GridControl).ExportToXls(dialog.FileName, options);
}
else if (grid is BandedGridView)
{
options.ExportType = DevExpress.Export.ExportType.WYSIWYG;
(grid as BandedGridView).OptionsPrint.AutoWidth = false;
(grid as BandedGridView).OptionsPrint.PrintBandHeader = true;
(grid as BandedGridView).ExportToXls(dialog.FileName, options);
}
else if (grid is TreeList)
{
(grid as TreeList).ExpandAll();
(grid as TreeList).ExportToXls(dialog.FileName, options);
}
XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
WinForm------如何将GridControl数据导出到Excel的更多相关文章
- 学习笔记 DataGridView数据导出为Excel
DataGridView数据导出为Excel 怎样把WinForm下的“DGV”里的绑定数据库后的数据导出到Excel中. 比如:在窗体里有个一“DGV”,DataGridView1,绑定了数据源 ...
- Dev GridControl数据导出格式问题
环境:DevExpress9.3,Vs2008 DevExpress的GridControl提供方便的数据导出到Excel功能,导出中用户可以根据GridControl的格式进行导出(ExportTo ...
- 将C1Chart数据导出到Excel
大多数情况下,当我们说将图表导出到Excel时,意思是将Chart当成图片导出到Excel中.如果是这样,你可以参考帮助文档中保存和导出C1Chart章节. 不过,也有另一种情况,当你想把图表中的数据 ...
- vb.net-三种将datagridview数据导出为excel文件的函数
第一种方法较慢,但是数据格式都比较好,需要引用excel的 Microsoft.Office.Interop.Excel.dll office.dll #Region "导出excel函数 ...
- 数据导出至Excel文件--好库编程网http://code1.okbase.net/codefile/SerializeHelper.cs_2012122018724_118.htm
using System; using System.IO; using System.Data; using System.Collections; using System.Data.OleDb; ...
- 数据导出到Excel中
自己修改后的一个数据导出到Excel的方法,粘出来与大家共享. 只需要将 System.Web.HttpContext.Current.Response.Charset = ...
- asp.net将数据导出到excel
本次应用datatable导出,若用gridview(假设gridview设为了分页显示)会出现只导出当前页的情况. protected void btnPrn_Click(object sender ...
- 将datagrid中数据导出到excel中 -------<<工作日志2014-6-6>>
前台datagrid数据绑定 #region 导出到excel中 /// <summary> /// 2014-6-6 /// </summary> / ...
- 机房收费系统——在VB中将MSHFlexGrid控件中的数据导出到Excel
机房收费系统中,好多查询的窗体都包含同一个功能:将数据库中查询到的数据显示在MSHFlexGrid控件中,然后再把MSHFlexGrid控件中的数据导出到Excel表格中. 虽然之前做过学生信息管理系 ...
随机推荐
- PHP-- 获取http请求头信息
看官方文档: http://php.net/manual/zh/function.apache-request-headers.php http://php.net/manual/zh/functio ...
- PS转手绘
2014-08-03 一.人物皮肤处理 复制两层图层,对背景图层隐藏,最后一层 高斯模糊 ,按住ALT创建图层蒙版, 使用画笔工具涂抹人物皮肤,眼睛不涂,把阴影和高光处抹均匀,最后应用图层蒙版,向下 ...
- Apache启动提示 httpd: apr_sockaddr_info_get() failed for xxx
httpd: apr_sockaddr_info_get() failed for xxx httpd: Could not reliably determine the server's fully ...
- 素数筛 poj 2689
素数筛 #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; ...
- 用cmd重命名.htaccess
本人上天修改PHP下伪静态文件htaccess.txt,需要改为.htaccess要是在Linux倒是很随意的事情,可惜window不给改,真的不可改吗,其实方法还是很多的,比如复制在记事本另存也可以 ...
- linux 命令行下更换软件源
首先备份默认源: sudo cp /etc/apt/sources.list /etc/apt/sources.list.old 清空默认源: sudo cat /dev/null > /etc ...
- Jquery-input获取单选框选择的按钮
$('input[name="radio"]:checked').val();
- 使用fiddler查看https请求
首先点击菜单栏Tools>>>Fiddler Options>>>HTTPS 把Decrypt HTTPS Traffic 复选框勾选上 勾上之后,会弹窗提示你. ...
- Oracle触发器反向调用Java程序
导入jar包 在oracle中导入需要的jar包,我们把编辑好的java类打成jar包,直接在oarcle里面写简单的调用就可以了, 1.操作系统需要拥有支持loadjava命令的jdk. 2.加载j ...
- Java多线程与并发库高级应用-可阻塞的队列
ArrayBlockQueue 可阻塞的队列 > 队列包含固定长度的队列和不固定长度的队列. > ArrayBlockQueue > 看BlockingQueue类的帮助文档,其中有 ...