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表格中. 虽然之前做过学生信息管理系 ...
随机推荐
- poj 1324 Holedox Moving
poj 1324 Holedox Moving 题目地址: http://poj.org/problem?id=1324 题意: 给出一个矩阵中,一条贪吃蛇,占据L长度的格子, 另外有些格子是石头, ...
- js中的forEach
chrome和firefox支持数组的forEach,但不支持对象的forEach,IE啥都不支持 jquery中的$.each(ArrayOrObject,function)既可以遍历数组又可以遍历 ...
- viewSub惰性装载器
在需要的时候才解析,不耗费资源 <ViewStub android:id="@+id/stub" android:layout_width="wrap_conten ...
- 顺序栈C语言实现
"` #include <stdio.h> #define MAXSIZE 10001 #define ELEMTYPE int #define STACK_EMPTY -999 ...
- Eclipse设置不格式化注释
Eclipse设置不格式化注释 注释中写点带格式的文字,format后全乱了,解决办法如下: Windows -> Preferces -> java -> Code Style - ...
- mysql-函数if多值多结果判断
if语句 案例:同样统计男女生人数,语句如下: ,)) 男生数,,)) 女生数, ,,)) pass1,,,)) pass0, ,,)) state1,,,)) state0 FROM sch GRO ...
- C#-WinForm-菜单和工具栏
通用属性: Enabled - 指示是否启用该控件. Visiable - 确定该控件是启用还是隐藏的. Checked - 指示组件是否处于选中状态. 点击事件. 工具箱→菜单和工具栏 1.Cont ...
- C# String.Format格式说明
C#格式化数值结果表 字符 说明 示例 输出 C 货币 string.Format("{0:C3}", 2) $2.000 D 十进制 string.Format("{0 ...
- 【CodeForces 266C】Below the Diagonal(模拟)
题目每次把空列换到最后一列,把非空行换到最下一行. #include<cstdio> #include<algorithm> #define N 1005 using name ...
- R 绘图 填充颜色
d <- density(mtcars$mpg) plot(d, main="Kernel Density of Miles Per Gallon") polygon(d, ...