从Infragistics UltraWebGrid 导出数据到Excel

在?Infragistics UltraWebGrid 所在的页面上点击鼠标右键,可以在右键菜单中选择“导出到Microsoft Office Excel(X)”来实现将Infragistics UltraWebGrid 中的数据导出到Excel中,但是对于复合表头或者有隐藏行、隐藏列的情况,用这种方法处理起来就不太方便,会给客户增加一些不必要的处理麻烦。为了能方便的处理将有复合表头、隐藏行、隐藏列的Infragistics UltraWebGrid 中的数据导出到Excel中,我编写了以下的导出类,可以实现导出功能。由于时间有限,对于导出后背景颜色等细节的处理,没有添加进去。代码如下:

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Knowusing?System;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Knowusing?System.Collections.Generic;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Knowusing?System.Text;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Knowusing?System.Data;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know//添加引用:Com?->?Microsoft?Excel?11.0?Object?Library?

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Knowusing?Microsoft.Office.Core;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Knowusing?Microsoft.Office.Interop.Excel;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Knowusing?Infragistics.WebUI.UltraWebGrid;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Knowusing?System.Web;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Knowusing?System.Web.UI;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Knowusing?System.Web.UI.WebControls;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Knowusing?System.IO;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Knowusing?System.Diagnostics;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Knownamespace?ExportToExcel

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????/**////?<summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????///?导出数据到Excel的类

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????///?</summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????public?class?Export

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????private?Microsoft.Office.Interop.Excel.Application?xlApp;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????private?Microsoft.Office.Interop.Excel.Workbook?workbook;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????private?object?missing?=?System.Reflection.Missing.Value;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????private?byte[]?Buffer;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know???????

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????//导出文件的路径(长名)

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????private?string?Report?=?"";

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????//导入到Excel时的行开始位置

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????private?int?rowStartIndex?=?1;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????//导入到Excel时的列开始位置

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????private?int?colStartIndex?=?1;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????//是否显示标题

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????bool?isShowTitle?=?true;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????//是否显示边框线

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????bool?isShowGridLine?=?true;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????//表格标题字体大小

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????private?int?titleFontSize?=?14;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????//表格内容字体大小

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????private?int?tableFontSize?=?12;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????/**////?<summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????///?获取或设置导入到Excel时在Excel中行的开始位置(大于0的整数)

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????///?</summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????public?int?RowStartIndex

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????get?...{?return?rowStartIndex;?}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????set?

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????if?(value?>?0)

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????????rowStartIndex?=?value;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????else

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????????rowStartIndex?=?1;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????/**////?<summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????///?获取或设置导入到Excel时在Excel中列的开始位置(大于0的整数)

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????///?</summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????public?int?ColStartIndex

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????get?...{?return?colStartIndex;?}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????set?

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????if?(value?>?0)

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????????colStartIndex?=?value;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????else

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????????colStartIndex?=?1;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????/**////?<summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????///?获取或设置是否显示表格标题

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????///?</summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????public?bool?IsShowTitle

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????get?...{?return?isShowTitle;?}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????set?...{?isShowTitle?=?value;?}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????/**////?<summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????///?获取或设置是否显示表格的边框和格线

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????///?</summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????public?bool?IsShowGridLine

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????get?...{?return?isShowGridLine;?}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????set?...{?isShowGridLine?=?value;?}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????/**////?<summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????///?获取或设置表格标题字体大小(大于0的整数)

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????///?</summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????public?int?TitleFontSize

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????get?...{?return?titleFontSize;?}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????set

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????if?(value?>?0)

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????????titleFontSize?=?value;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????else

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????????titleFontSize?=?14;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????/**////?<summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????///?获取或设置表格内容字体大小(大于0的整数)

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????///?</summary>

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????public?int?TableFontSize

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????get?...{?return?tableFontSize;?}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????set

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????if?(value?>?0)

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????...{

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????????tableFontSize?=?value;

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????}

从Infragistics UltraWebGrid 导出数据到Excel - Start Know - Start Know????????????????else

从Infragistics UltraWebGrid 导出ਤ

分享到:
评论

你可能感兴趣的:(Web,UI,Microsoft,Excel,Office)