using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.IO;

using DevExpress.XtraGrid.Views.BandedGrid;

using DevExpress.XtraPrintingLinks;

using DevExpress.XtraPrinting;

private void Form1_Load(object sender, EventArgs e)

{

DataTable dt1 = new DataTable();

dt1.Columns.Add("a1");

dt1.Columns.Add("a2");

dt1.Columns.Add("a3");

dt1.Columns.Add("a4");

DataTable dt2 = dt1.Copy();

dt1.Rows.Add("A", "22222", "22222", "22222");

dt1.Rows.Add("B", "33333333333", "33333333333", "3");

dt1.Rows.Add("C", "12", "24", "3");

dt2.Rows.Add("AA", "1", "1", "3");

dt2.Rows.Add("AA", "222", "555", "3");

dt2.Rows.Add("BB", "12", "24", "3");

dt2.Rows.Add("BB", "13", "22222", "3");

gridControl1.DataSource = dt1;

gridControl3.DataSource = dt2;

}

private void Btn_Excel_Click(object sender, EventArgs e)

{

CompositeLink complink = new CompositeLink(new PrintingSystem());

PrintableComponentLink link = new PrintableComponentLink();

link.Component = gridControl1;

PrintableComponentLink link2 = new PrintableComponentLink();

link2.Component = gridControl3;

complink.Links.Add(link);

complink.Links.Add(link2);

complink.CreatePageForEachLink();

complink.ExportToXlsx("file1.xlsx", new XlsxExportOptions() { ExportMode = XlsxExportMode.SingleFilePageByPage });

}

Gridview导出EXCEL(多页) z的更多相关文章

  1. GridView导出Excel的超好样例

    事实上网上有非常多关于Excel的样例,可是不是非常好,他们的代码没有非常全,读的起来还非常晦涩.经过这几天的摸索,最终能够完毕我想要导出报表Excel的效果了.以下是我的效果图. 一.前台的页面图 ...

  2. Asp.net Gridview导出Excel

    前台页面放一个GridView什么的就不说了,要注意的是在 <%@ Page Language="C#" AutoEventWireup="true" C ...

  3. C#实现GridView导出Excel

    using System.Data;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System. ...

  4. ASP.NET gridview导出excel,防止繁体产生有乱码的方式

    //1.先引用比如 : using System; using System.Collections.Generic; using System.Linq; using System.Web; usi ...

  5. GridView导出excel格式问题

    在导出的点击事件中,代码如下: //指定导出对应单元格为文本样式 string style = @"<style> .test { vnd.ms-excel.numberform ...

  6. C# GridView 导出Excel表

    出错1:类型“GridView”的控件“GridView1”必须放在具有 runat=server 的窗体标记内解决方案:在后台文件中重载VerifyRenderingInServerForm方法,如 ...

  7. GridView导出Excel(中文乱码)

    public void OUTEXCEL(string items,string where) { DataSet ds = new StudentBLL().GetTable(items,where ...

  8. GridView导出Excel

    public void OUTEXCEL() { DataSet ds = new GW_T_DemandDAL().GetWzH(GetPersonInfoData(UserInfo), Reque ...

  9. GridView 导出Excel

    protected void btnExcel_Click(object sender, EventArgs e) { ) { ExportGridViewForUTF8(GridView1, Dat ...

随机推荐

  1. gitd模式-主从备份恢复

    主从节点分配: 192.168.1.100 master binlog server读取节点 192.168.1.101 slave 备份节点 备注:binlog server从master节点备份b ...

  2. MVC模式与三层架构的区别

    之前总是混淆MVC表现模式和三层架构模式,为此记录下. 三层架构和MVC是有明显区别的,MVC应该是展现模式(三个加起来以后才是三层架构中的UI层) 三层架构(3-tier application) ...

  3. PostgreSQL 列出所有表名和数据库名

    列出表名   直接 \d 不加参数 或 SELECT   tablename   FROM   pg_tables   WHERE   tablename   NOT   LIKE   'pg%'   ...

  4. iOS开发拓展篇—UIDynamic(简单介绍)

    iOS开发拓展篇—UIDynamic(简单介绍) 一.简单介绍 1.什么是UIDynamic UIDynamic是从iOS 7开始引入的一种新技术,隶属于UIKit框架 可以认为是一种物理引擎,能模拟 ...

  5. iOS开发UI篇—popoverController简单介绍

    iOS开发UI篇—popoverController简单介绍 一.简单介绍 1.什么是UIPopoverController 是iPad开发中常见的一种控制器(在iPhone上不允许使用) 跟其他控制 ...

  6. PHP投票系统

    1.投票页面 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. ...

  7. ABAP遇到的问题——1

    在创建ABAP对象的时候抛出“测试对象不能被创建在外来命名空间”的错误 原因:程序的名字不是以Z或者Y开头的.

  8. Node.js 函数

    Node.js 函数 在JavaScript中,一个函数可以作为另一个函数接收一个参数.我们可以先定义一个函数,然后传递,也可以在传递参数的地方直接定义函数. Node.js中函数的使用与Javasc ...

  9. Swift语言—常量、变量、类型赋值

    常量:常量在作用域内不能被赋值且不会发生改变,只读不写,每个常量都必须有唯一的名字和内存空间:关键字:let   变量:变量在作用区域内可以它的值可以被改变,可读可写可覆盖,每个常量都必须有唯一的名字 ...

  10. Wireshark找不到网络接口问题

    Wireshark找不到网络接口问题 在运行Wireshark工具抓包时,需要有管理员用户权限.如果是普通用户启动的话,将会提示找不到网络接口.