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. NSRunLoop概述和原理

    1.什么是NSRunLoop?我们会经常看到这样的代码: - (IBAction)start:(id)sender{pageStillLoading = YES;[NSThread detachNew ...

  2. 用dbforge调试procedure

    工具官网地址:http://www.devart.com/dbforge/mysql/studio/ 对于某些存储过程很多且复杂的SQL的应用,在短时间内要使得所有MySQL存储过程和函数正常运行,那 ...

  3. cloud theory is a failure? 分类: Cloud Computing 2013-12-26 06:52 269人阅读 评论(0) 收藏

    since LTE came out, with thin client cloud computing  and broadband communication clouding 不攻自破了.but ...

  4. 关于MySQL中的left join、on、where的一点深入

    原文地址:http://www.oschina.net/question/89964_65912?sort=default&p=3#answers 即使你认为自己已对 MySQL 的 LEFT ...

  5. phalcon:跟踪sql语句

    在phalcon里有一个\Phalcon\Db\Profiler 类,这个类可以用来记录sql语句并计算消耗的时间.那么如何使用它呢? 手册里其实已经提供了方法,总结如下: 1.向$di里注册prof ...

  6. CSS缩放函数, 旋转函数与倾斜函数

       1 :缩放        scale(x,y)函数让元素根据中心原点对对象进行缩放,大于1进行放大,小于1则缩小,如果为负值,则先进行翻转再进行缩放操作. 实例: HTML: <div c ...

  7. Javascript的delete

    Javascript中的激活对象(Activation object)和变量对象(Variable object):每个执行上下文在其内部都有一个Variable Object.与执行上下文类似,Va ...

  8. 《JavaScript模式》第3章 字面量和构造函数

    @by Ruth92(转载请注明出处) 第3章:字面量和构造函数 一.创建对象的三种方式 // 对象字面量 var car = {goes: "far"}; // 内置构造函数(反 ...

  9. Java 设计一个贷款计算器 简易

    import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.border.*; publi ...

  10. 将war包部署到服务器的详细步骤

    第一步: 先将项目打包成war文件,也就是将在项目上单击鼠标右键,选择Export: 选择WAR file,点击下一步: 会出现如下所示,选择你要保存的位置,点击完成: 在你所选择的地方会有个如下所示 ...