日期:2014-05-16 浏览次数:20709 次
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment;filename=\"xxxx.xls\"");
Response.Write("生成的内容字符串");
/*
*功能:直接由Ext的grid生成Excel
*注意: 只支持IE
*参数:param1: gridId
* param2: sheetName
*/
Ext.downExcel= function(config){
//Ext.Excel.superclass.constructor.call(this, config);
Ext.apply(this,config);
};
Ext.apply(Ext.downExcel.prototype,{
extGridToExcel : function(){
if (!Ext.isIE) {
Ext.Msg.alert('Error','你的浏览器不支持!');
return;
}
try{
if(Ext.getCmp(this.gridId)){
/********************************************* grid 生成 Excel ***************************************/
var oXL = new ActiveXObject("Excel.Application");
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var grid = Ext.getCmp(this.gridId);
&n