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. AIX修改用户密码登录不成功案例分享

    背景:使用passwd XXXX fcesjaif,修改新密码仍然提示密码不正确.拒绝登录 a. 使用命令lsuser -f XXXX |grep -i successful 查看不成功的次数 chu ...

  2. git中通过实际操作来了解常用命令

    基本的6个命令 常用的就下面6个命令,但是详细的可能有上百个命令. 还需要特别了解git的几个名词,workspace:工作区,Index/Stage:暂存区,Respository:本地仓库,Rem ...

  3. WCF初探-1:认识WCF

    1.WCF是什么? WindowsCommunication Foundation(WCF)是由微软发展的一组数据通信的应用程序开发接口,它是.NET框架的一部分,由.NET Framework 3. ...

  4. solr windows 启动和关闭命令

    进入bin目录执行  启动:solr -e dih 停止:solr stop -all D:\Solr\solr-5.2.1\solr-5.2.1\bin>solr -e dih

  5. My Game --简介

    曾经 我们雄心壮志,曾经 我们慷慨激昂,曾经 我们豪情满天涯. 曾经我们一起策划玩法,寻找背景题材,编写代码,幻想没有的更新.此刻由最后的孤狼把仅有成果分享给大伙. 所谓的玩法,背景,每个游戏都与众不 ...

  6. HDU 2871 Memory Control

    一共4种操作 其中用线段树 区间合并,来维护连续空的长度,和找出那个位置.其他用vector维护即可 #include<cstring> #include<cstdio> #i ...

  7. <li>高度自适应

    使用ul和li代替表格进行排版的时候,会发现li无法自适应高度. 只需要将li的overflow置为auto就可以了,因为li默认的overflow是visible,会将内部元素显示在li之外.   ...

  8. Android 生成颜色器

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools=&q ...

  9. 转 Flex MXML编译成AS类

    2009-09-22 23:25 Flex MXML编译成AS类 由“Flex 基础”文中可知:每一个mxml文件首先要编译成as文件,然后再译成swf文件.app.mxml文件编译后会产生一系列中间 ...

  10. 对hbase的学习

    HBase,是Hadoop DataBase. 面向列的分布式数据库, 思想来源于Google的BigTable思想,它的目标是在廉价硬件构成的集群上管理超大规模的稀疏表. Hbase的物理结构 HB ...