转载:

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的更多相关文章

  1. 学习笔记 DataGridView数据导出为Excel

    DataGridView数据导出为Excel   怎样把WinForm下的“DGV”里的绑定数据库后的数据导出到Excel中. 比如:在窗体里有个一“DGV”,DataGridView1,绑定了数据源 ...

  2. Dev GridControl数据导出格式问题

    环境:DevExpress9.3,Vs2008 DevExpress的GridControl提供方便的数据导出到Excel功能,导出中用户可以根据GridControl的格式进行导出(ExportTo ...

  3. 将C1Chart数据导出到Excel

    大多数情况下,当我们说将图表导出到Excel时,意思是将Chart当成图片导出到Excel中.如果是这样,你可以参考帮助文档中保存和导出C1Chart章节. 不过,也有另一种情况,当你想把图表中的数据 ...

  4. vb.net-三种将datagridview数据导出为excel文件的函数

    第一种方法较慢,但是数据格式都比较好,需要引用excel的 Microsoft.Office.Interop.Excel.dll  office.dll #Region "导出excel函数 ...

  5. 数据导出至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; ...

  6. 数据导出到Excel中

    自己修改后的一个数据导出到Excel的方法,粘出来与大家共享. 只需要将             System.Web.HttpContext.Current.Response.Charset =   ...

  7. asp.net将数据导出到excel

    本次应用datatable导出,若用gridview(假设gridview设为了分页显示)会出现只导出当前页的情况. protected void btnPrn_Click(object sender ...

  8. 将datagrid中数据导出到excel中 -------<<工作日志2014-6-6>>

    前台datagrid数据绑定 #region 导出到excel中    /// <summary>    /// 2014-6-6    /// </summary>    / ...

  9. 机房收费系统——在VB中将MSHFlexGrid控件中的数据导出到Excel

    机房收费系统中,好多查询的窗体都包含同一个功能:将数据库中查询到的数据显示在MSHFlexGrid控件中,然后再把MSHFlexGrid控件中的数据导出到Excel表格中. 虽然之前做过学生信息管理系 ...

随机推荐

  1. LVS ip-tun服务器脚本

    ifconfig tunl0 192.168.10.10 netmask 255.255.255.255 up route add -host 192.168.10.10 dev tunl0 ipvs ...

  2. [转]跟我一起学extjs5(02--建立工程项目)

    原文地址:http://blog.csdn.net/jfok/article/details/35569057 目录(?)[+] 跟我一起学extjs5(02--建立工程项目) 我们先建立一个java ...

  3. Android 用代码设置Shape,corners,Gradient

    网上查找资料 记录学习 int strokeWidth = 5; // 3dp 边框宽度 int roundRadius = 15; // 8dp 圆角半径 int strokeColor = Col ...

  4. Intellij 常用快捷键

    Project [Alt+1]Version Control [Alt+9]Run [Ctrl+Shift+F10]Debug [Ctrl+Shift+F11]Terminal [Alt+F12]Ed ...

  5. Get it,你离几何达人不远了!

    对于爱学几何的人,是否存在这样的困扰:没有标准的尺规工具,图形画的不标准,理解上总是出错......整天在纸上画图,浪费大把大把的时间......几何图形画的不美观,在别人面前都拿不出手,公开课上都没 ...

  6. win7下安装redies

    https://github.com/MSOpenTech/redis 打开以后,可以直接使用浏览器下载,或者git克隆.注意:下载release版 解压后,目录下有以下这些文件: redis-ben ...

  7. js base64位和c# Base64位转换

    <script> /* 编码规则 Base64编码的思想是是采用64个基本的ASCII码字符对数据进行重新编码. 它将需要编码的数据拆分成字节数组. 以3个字节为一组.按顺序排列24 位数 ...

  8. double截取小数点位数

    (double)decimal.Round(decimal.Parse((planVoSt.TotalCompleteAmount / planVoSt.TotalUserCount).ToStrin ...

  9. 【BZOJ-4173】数学 欧拉函数 + 关于余数的变换

    4173: 数学 Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 306  Solved: 163[Submit][Status][Discuss] D ...

  10. codeforces 723F : st-Spanning Tree

    Description There are n cities and m two-way roads in Berland, each road connects two cities. It is ...