1、&=DataSource.Field,&=[DataSource].[Field]是对DataTable和几何类型的引用,将会从当前行开始竖直向下生成多行数据。

2、&=$data:是对变量或数组的引用。数组存在skiphorizontal等属性,具体参见官方网站

3、&=&=动态公式计算;{r}当前行,{c}当前列,{-n},{n}当前行或列的偏移量前n或后n。

4、&==是动态计算,如excel,if等语句。(if(logic_test,true_value,false_value))

前端extjs代码

   ///导出Excel
function Export() {
opt = 'Export';
if (!Ext.fly('frmDummy')) {
var frm = document.createElement('form');
frm.id = 'frmDummy';
frm.name = id;
frm.className = 'x-hidden';
document.body.appendChild(frm);
}
Ext.Ajax.request({
url: 'Renewal.aspx',
method: 'POST',
form: Ext.fly('frmDummy'),
isUpload: true,
params: { 'Opt': opt, file: 'FileName', name: escape('墓地到期续费价格单')}//file为excel模板的文件名,name为导出后的excel文件名
}); }

客户端代码:

 /// <summary>
/// 导出Excel
/// </summary>
public void Export()
{
string file = Request.Form["file"];
string name = Server.UrlDecode(Request.Form["name"].ToString());
string SQL_EXPORT = @"SELECT * FROM FYB_MDDQXF";
//导出的数据源
DataSet ds = DBhelper.Query(SQL_EXPORT); WorkbookDesigner designer = new WorkbookDesigner();
//Excel模版路径
string path = MapPath("Excel/" + file + ".xls");
designer.Open(path);
//将数据源加载到文件
designer.SetDataSource(ds);
designer.Process(); //使服务器能够收集有关在客户端运行的浏览器功能的信息
HttpBrowserCapabilities bc = HttpContext.Current.Request.Browser;
string filename = "";
//判断当前浏览器是否为IE
if (bc.Browser == "IE")
filename = HttpUtility.UrlEncode(name, System.Text.Encoding.UTF8) + ".xls";
else
filename = name + ".xls";
//将Excel文件保存
designer.Save(filename, SaveType.OpenInExcel, FileFormatType.Default, this.Response); Response.Flush();
Response.Close();
designer = null;
Response.End();
}

接下来是Excel模版的设置了

打开FileName.xls文件,将模版设置城如下格式

刚开始我也琢磨了下,后来才发现模版需要这样设置

extjs+Aspose.Cells导出到Excel的更多相关文章

  1. Aspose.Cells导出Excel(1)

    利用Aspose.Cells导出excel 注意的问题 1.DataTable的处理 2.进行编码,便于中文名文件下载 3.别忘了Aspose.Cells.dll(可以自己在网上搜索) public ...

  2. 利用Aspose.Cells导出Datatable数据

    面对一些的格式各样的到处数据的要求,自学了一点 Aspose.Cells中操作Excel知识,如下代码: /// <summary> /// DataTable导出Excel /// &l ...

  3. C#使用Aspose.Cells导出Excel简单实现

    首先,需要添加引用Aspose.Cells.dll,官网下载地址:http://downloads.aspose.com/cells/net 将DataTable导出Xlsx格式的文件下载(网页输出) ...

  4. Aspose.Cells导出Excel(2)

    DataTable dtTitle = ds.Tables[]; DataTable dtDetail = ds.Tables[]; int columns = dtTitle.Columns.Cou ...

  5. C#+Aspose.Cells 导出Excel及设置样式 (Webform/Winform)

    在项目中用到,特此记录下来,Aspose.Cells 不依赖机器装没有装EXCEL都可以导出,很方便.具体可以参考其他 http://www.aspose.com/docs/display/cells ...

  6. C# 使用Aspose.Cells 导出Excel

    今天在工作中碰到同事用了一种新型的方式导入excel,在此做个学习记录. 插件:Aspose.Cells 第一步:准备好导出的模板,例子: C#代码: #region 验证数据 if (model = ...

  7. aspose.Cells 导出Excel

    aspose aspse.Cells可以操作Excel,且不依赖于系统环境. 使用模板,通过绑定输出数据源 这种适合于对格式没有特别要求的,直接绑定数据源即可.和数据绑定控件差不多. Workbook ...

  8. Aspose.Cells 导出 excel

    Aspose.Cells.Workbook book = new Aspose.Cells.Workbook(); Aspose.Cells.Worksheet sheet = book.Worksh ...

  9. aspose.cells导出Demo

    /// <summary> /// 导出excel /// </summary> /// <param name="list"></par ...

随机推荐

  1. (转)Asp.Net 请求处理机制

    原文:http://www.cnblogs.com/cilence/archive/2012/05/28/2520712.html Asp.Net 请求处理机制   前言 我们都知道Web请求响应是基 ...

  2. SQLSERVER2008 显示列信息,包含扩展属性

    select b.name as table_name,a.name as column_name,t.name type_name        ,a.max_length ,a.precision ...

  3. Local IIS 7.0 - CS0016: Could not write to output file / Microsoft.Net > Framework > v4.0.30319 > Temporary ASP.NET Files

    This week I went nuts over my local IIS. I have never swore to a machine that much in my whole life. ...

  4. (转)Android Service 双进程常驻后台(2)

    最近项目用到Service常驻后台,研究了一下发现手Q和微信都是使用了双进程来保证一键清理后自动复活,copy网上双进程Service的例子,再结合onTrimMemory(),基本实现一键清理后自动 ...

  5. OSPF + LVS ,突破LVS瓶颈 (转)

    突破LVS瓶颈,LVS Cluster部署(OSPF + LVS) 前言 架构简图 架构优势 部署方法 1.硬件资源准备 2.三层设备OSPF配置 3.LVS调度机的OSPF配置 a.安装软路由软件q ...

  6. 修正constructor的指向

    function Aaa(){ } //Aaa.prototype.constructor = Aaa;   //每一个函数都会有的,都是自动生成的 Aaa.prototype.name = '小明' ...

  7. js隔行变色

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. css 多出一行或多行后显示...的方法

    一行超出显示... .mui-ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } 两行超出的显示. ...

  9. iOS: 学习笔记, 使用FMDatabase操作sqlite3

    使用FMDatabase操作sqlite3数据库非常简单和方便 // // main.m // iOSDemo0602_sqlite3 // // Created by yao_yu on 14-6- ...

  10. Find your present (2) (位异或)

    Problem Description In the new year party, everybody will get a "special present".Now it's ...