<html>
<head>
<title>excelpanel</title>
<meta http-equiv="Content-Type" content="text/html; charset="gb2312">
<link rel="stylesheet" type="text/css" href="../jsCommon/ext/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="../excelCommon/ExcelPanel.css">
<script type="text/javascript" src="../jsCommon/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../jsCommon/ext/ext-all.js"></script>
<script type="text/javascript" src="ExcelPanel.js"></script>
<script type="text/javascript">
function getPath()
{
var htmlpath = window.location.href;
var dirpath = htmlpath;
if(htmlpath.substring(0,8) == "file:///") dirpath = dirpath.substring(8);
dirpath = dirpath.substring(0,dirpath.lastIndexOf("/"));
dirpath = dirpath.split("/").join("\\");
return dirpath + "\\";
}
var disableBtns = ["savecopy","print","preview","zoomin","zoomout","test"];
Ext.onReady(function(){ var p = new Ext.ux.ExcelPanel({
//xls : getPath()+"excelpanel.xls",
title:'Ext.ux.ExcelPanel Extension by kimmking',
height:700,
width:1200,
//titleCollapse : true,
//collapsible : true,
//draggable : true,
tbar : [
{
id : 'open',
iconCls : 'open',
text : '打开',
tooltip : '打开',
handler : function(btn)
{
p.open(getPath()+"excelpanel.xls");
Ext.each(disableBtns,function(item){
Ext.getCmp(item).enable();
});
}
}
]
});
p.render(document.body);
});
</script>
<title id="page-title">Ext.ux.ExcelPanel Extension by kimmking</title>
</head>
<body>
</body>
</html>Js代码Ext.ux.ExcelPanel = Ext.extend(Ext.Panel,
{ dso : null
,store : null
,xls : null
,zoom : 100
,available : false
, html : "<object classid='clsid:00460182-9E5E-11d5-B7C8-B8269041DD57' id='dso' CODEBASE='cab/dsoframer.cab#version=2,0,0,0'>"
+ "<PARAM NAME='_ExtentX' VALUE='16960'> "
+ "<PARAM NAME='_ExtentY' VALUE='13600'> "
+ "<PARAM NAME='BorderColor' VALUE='-2147483632'> "
+ "<PARAM NAME='BackColor' VALUE='-2147483643'> "
+ "<PARAM NAME='ForeColor' VALUE='-2147483640'> "
+ "<PARAM NAME='TitlebarColor' VALUE='-2147483635'> "
+ "<PARAM NAME='TitlebarTextColor' VALUE='-2147483634'> "
+ "<PARAM NAME='BorderStyle' VALUE='0'> "
+ "<PARAM NAME='Titlebar' VALUE='0'> "
+ "<PARAM NAME='Toolbars' VALUE='0'> "
+ "<PARAM NAME='Menubar' VALUE='0'>" + "</OBJECT>"
debugger:
, initComponent : function(){
Ext.ux.ExcelPanel.superclass.initComponent.call(this);
this.addEvents(
'afterrender'
);
}
,afterRender : function(){
Ext.ux.ExcelPanel.superclass.afterRender.call(this); // do sizing calcs last if(typeof(dso) == 'undefined')
this.dso = document.getElementById("dso");
else
this.dso = dso;
if(!dso)
{
alert( "加载DsoFramer出错,请先注册组件.");
}else
{
dso.width = this.getInnerWidth();
dso.height = this.getInnerHeight();
this.on("resize",function(ep){
dso.width = ep.getInnerWidth();
dso.height = ep.getInnerHeight();
});
}
this.fireEvent("afterrender", this);
if(this.dso)
{
if(this.xls)
{
this.open(this.xls);
}
}
}
////////////
,open : function(filename)
{
try{
this.dso.Open(filename);
this.dso.ActiveDocument.Application.CommandBars("Web").Visible = false;
this.available = true;
}catch(e)
{
alert( "打开文件出错." + "["+ this.xls +"]:" + e.description);
}
}
/////********************
,setCellValue : function(row,col,value)
{
try{
this.dso.ActiveDocument.ActiveSheet.Cells(row,col) = value;
}catch(e)
{
alert( "Excel赋值出错." + "["+ row +"," +col +"]=" + value+ "\r\n" +e.description);
}
}
,getCellValue : function(row,col)
{
try{
return this.dso.ActiveDocument.ActiveSheet.Cells(row,col).Value;
}catch(e)
{
alert( "Excel取值出错." + "["+ row +"," +col +"]" +e.description);
}
}
/*************************************************
from GridView
*************************************************/
// private
,
initData : function(ds, cm){
if(this.ds){
this.ds.un("load", this.onLoad, this);
this.ds.un("datachanged", this.onDataChange, this);
this.ds.un("add", this.onAdd, this);
this.ds.un("remove", this.onRemove, this);
this.ds.un("update", this.onUpdate, this);
this.ds.un("clear", this.onClear, this);
}
if(ds){
ds.on("load", this.onLoad, this);
ds.on("datachanged", this.onDataChange, this);
ds.on("add", this.onAdd, this);
ds.on("remove", this.onRemove, this);
ds.on("update", this.onUpdate, this);
ds.on("clear", this.onClear, this);
}
this.ds = ds;// if(this.cm){
// this.cm.un("configchange", this.onColConfigChange, this);
// this.cm.un("widthchange", this.onColWidthChange, this);
// this.cm.un("headerchange", this.onHeaderChange, this);
// this.cm.un("hiddenchange", this.onHiddenChange, this);
// this.cm.un("columnmoved", this.onColumnMove, this);
// this.cm.un("columnlockchange", this.onColumnLock, this);
// }
// if(cm){
// cm.on("configchange", this.onColConfigChange, this);
// cm.on("widthchange", this.onColWidthChange, this);
// cm.on("headerchange", this.onHeaderChange, this);
// cm.on("hiddenchange", this.onHiddenChange, this);
// cm.on("columnmoved", this.onColumnMove, this);
// cm.on("columnlockchange", this.onColumnLock, this);
// }
this.cm = cm;
}, // private
onDataChange : function(){
this.refresh();
//this.updateHeaderSortState();
}, // private
onClear : function(){
this.refresh();
}, // private
onUpdate : function(ds, record){
this.refreshRow(record);
}, // private
onAdd : function(ds, records, index){
this.insertRows(ds, index, index + (records.length-1));
}, // private
onRemove : function(ds, record, index, isUpdate){
// if(isUpdate !== true){
// this.fireEvent("beforerowremoved", this, index, record);
// }
// this.removeRow(index);
// if(isUpdate !== true){
// this.processRows(index);
// this.applyEmptyText();
// this.fireEvent("rowremoved", this, index, record);
// }
}, // private
onLoad : function(){
//this.scrollToTop();
},// // private
// onColWidthChange : function(cm, col, width){
// this.updateColumnWidth(col, width);
// },// // private
// onHeaderChange : function(cm, col, text){
// this.updateHeaders();
// },// // private
// onHiddenChange : function(cm, col, hidden){
// this.updateColumnHidden(col, hidden);
// },// // private
// onColumnMove : function(cm, oldIndex, newIndex){
// this.indexMap = null;
// var s = this.getScrollState();
// this.refresh(true);
// this.restoreScroll(s);
// this.afterMove(newIndex);
// },// // private
// onColConfigChange : function(){
// delete this.lastViewWidth;
// this.indexMap = null;
// this.refresh(true);
// }
refresh : function()
{
},
refreshRow : function(r)
{
},
insertRows : function(ds, index, end){
}});
一直在红色的地方报对少对象的错误,请指教,谢谢
<head>
<title>excelpanel</title>
<meta http-equiv="Content-Type" content="text/html; charset="gb2312">
<link rel="stylesheet" type="text/css" href="../jsCommon/ext/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="../excelCommon/ExcelPanel.css">
<script type="text/javascript" src="../jsCommon/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../jsCommon/ext/ext-all.js"></script>
<script type="text/javascript" src="ExcelPanel.js"></script>
<script type="text/javascript">
function getPath()
{
var htmlpath = window.location.href;
var dirpath = htmlpath;
if(htmlpath.substring(0,8) == "file:///") dirpath = dirpath.substring(8);
dirpath = dirpath.substring(0,dirpath.lastIndexOf("/"));
dirpath = dirpath.split("/").join("\\");
return dirpath + "\\";
}
var disableBtns = ["savecopy","print","preview","zoomin","zoomout","test"];
Ext.onReady(function(){ var p = new Ext.ux.ExcelPanel({
//xls : getPath()+"excelpanel.xls",
title:'Ext.ux.ExcelPanel Extension by kimmking',
height:700,
width:1200,
//titleCollapse : true,
//collapsible : true,
//draggable : true,
tbar : [
{
id : 'open',
iconCls : 'open',
text : '打开',
tooltip : '打开',
handler : function(btn)
{
p.open(getPath()+"excelpanel.xls");
Ext.each(disableBtns,function(item){
Ext.getCmp(item).enable();
});
}
}
]
});
p.render(document.body);
});
</script>
<title id="page-title">Ext.ux.ExcelPanel Extension by kimmking</title>
</head>
<body>
</body>
</html>Js代码Ext.ux.ExcelPanel = Ext.extend(Ext.Panel,
{ dso : null
,store : null
,xls : null
,zoom : 100
,available : false
, html : "<object classid='clsid:00460182-9E5E-11d5-B7C8-B8269041DD57' id='dso' CODEBASE='cab/dsoframer.cab#version=2,0,0,0'>"
+ "<PARAM NAME='_ExtentX' VALUE='16960'> "
+ "<PARAM NAME='_ExtentY' VALUE='13600'> "
+ "<PARAM NAME='BorderColor' VALUE='-2147483632'> "
+ "<PARAM NAME='BackColor' VALUE='-2147483643'> "
+ "<PARAM NAME='ForeColor' VALUE='-2147483640'> "
+ "<PARAM NAME='TitlebarColor' VALUE='-2147483635'> "
+ "<PARAM NAME='TitlebarTextColor' VALUE='-2147483634'> "
+ "<PARAM NAME='BorderStyle' VALUE='0'> "
+ "<PARAM NAME='Titlebar' VALUE='0'> "
+ "<PARAM NAME='Toolbars' VALUE='0'> "
+ "<PARAM NAME='Menubar' VALUE='0'>" + "</OBJECT>"
debugger:
, initComponent : function(){
Ext.ux.ExcelPanel.superclass.initComponent.call(this);
this.addEvents(
'afterrender'
);
}
,afterRender : function(){
Ext.ux.ExcelPanel.superclass.afterRender.call(this); // do sizing calcs last if(typeof(dso) == 'undefined')
this.dso = document.getElementById("dso");
else
this.dso = dso;
if(!dso)
{
alert( "加载DsoFramer出错,请先注册组件.");
}else
{
dso.width = this.getInnerWidth();
dso.height = this.getInnerHeight();
this.on("resize",function(ep){
dso.width = ep.getInnerWidth();
dso.height = ep.getInnerHeight();
});
}
this.fireEvent("afterrender", this);
if(this.dso)
{
if(this.xls)
{
this.open(this.xls);
}
}
}
////////////
,open : function(filename)
{
try{
this.dso.Open(filename);
this.dso.ActiveDocument.Application.CommandBars("Web").Visible = false;
this.available = true;
}catch(e)
{
alert( "打开文件出错." + "["+ this.xls +"]:" + e.description);
}
}
/////********************
,setCellValue : function(row,col,value)
{
try{
this.dso.ActiveDocument.ActiveSheet.Cells(row,col) = value;
}catch(e)
{
alert( "Excel赋值出错." + "["+ row +"," +col +"]=" + value+ "\r\n" +e.description);
}
}
,getCellValue : function(row,col)
{
try{
return this.dso.ActiveDocument.ActiveSheet.Cells(row,col).Value;
}catch(e)
{
alert( "Excel取值出错." + "["+ row +"," +col +"]" +e.description);
}
}
/*************************************************
from GridView
*************************************************/
// private
,
initData : function(ds, cm){
if(this.ds){
this.ds.un("load", this.onLoad, this);
this.ds.un("datachanged", this.onDataChange, this);
this.ds.un("add", this.onAdd, this);
this.ds.un("remove", this.onRemove, this);
this.ds.un("update", this.onUpdate, this);
this.ds.un("clear", this.onClear, this);
}
if(ds){
ds.on("load", this.onLoad, this);
ds.on("datachanged", this.onDataChange, this);
ds.on("add", this.onAdd, this);
ds.on("remove", this.onRemove, this);
ds.on("update", this.onUpdate, this);
ds.on("clear", this.onClear, this);
}
this.ds = ds;// if(this.cm){
// this.cm.un("configchange", this.onColConfigChange, this);
// this.cm.un("widthchange", this.onColWidthChange, this);
// this.cm.un("headerchange", this.onHeaderChange, this);
// this.cm.un("hiddenchange", this.onHiddenChange, this);
// this.cm.un("columnmoved", this.onColumnMove, this);
// this.cm.un("columnlockchange", this.onColumnLock, this);
// }
// if(cm){
// cm.on("configchange", this.onColConfigChange, this);
// cm.on("widthchange", this.onColWidthChange, this);
// cm.on("headerchange", this.onHeaderChange, this);
// cm.on("hiddenchange", this.onHiddenChange, this);
// cm.on("columnmoved", this.onColumnMove, this);
// cm.on("columnlockchange", this.onColumnLock, this);
// }
this.cm = cm;
}, // private
onDataChange : function(){
this.refresh();
//this.updateHeaderSortState();
}, // private
onClear : function(){
this.refresh();
}, // private
onUpdate : function(ds, record){
this.refreshRow(record);
}, // private
onAdd : function(ds, records, index){
this.insertRows(ds, index, index + (records.length-1));
}, // private
onRemove : function(ds, record, index, isUpdate){
// if(isUpdate !== true){
// this.fireEvent("beforerowremoved", this, index, record);
// }
// this.removeRow(index);
// if(isUpdate !== true){
// this.processRows(index);
// this.applyEmptyText();
// this.fireEvent("rowremoved", this, index, record);
// }
}, // private
onLoad : function(){
//this.scrollToTop();
},// // private
// onColWidthChange : function(cm, col, width){
// this.updateColumnWidth(col, width);
// },// // private
// onHeaderChange : function(cm, col, text){
// this.updateHeaders();
// },// // private
// onHiddenChange : function(cm, col, hidden){
// this.updateColumnHidden(col, hidden);
// },// // private
// onColumnMove : function(cm, oldIndex, newIndex){
// this.indexMap = null;
// var s = this.getScrollState();
// this.refresh(true);
// this.restoreScroll(s);
// this.afterMove(newIndex);
// },// // private
// onColConfigChange : function(){
// delete this.lastViewWidth;
// this.indexMap = null;
// this.refresh(true);
// }
refresh : function()
{
},
refreshRow : function(r)
{
},
insertRows : function(ds, index, end){
}});
一直在红色的地方报对少对象的错误,请指教,谢谢
解决方案 »
- ntko错误
- Ext.ux.grid.RowExpander 如何设置为默认展开效果
- 为什么单页测试通过,放到程序里就不行呢?
- 列表内的图片如何和显示的图片对应
- (ExtJs)HttpProxy怎么连接到struts啊
- 有个下拉列表框,其中有一项值是”其它“,在下拉列表框的下面有三个文本框,当选择了下拉列表框中得”其它“时,下面得三个文本框就不让
- <a href="#" onClick="createEle();setTimeout('recvvideo("'"<%=session("u_name")%>"'")',100);">
- 求大大们帮忙解密这些js代码,先谢谢了
- js获取动态绑定的事件名
- 如何让Javascript支持多编码(unicode)? 象高手请教,高分
- js 中对象中的对象
- Chrome处理动态写入页面的问题
是只ext自己包里的么?还是?我刚用,不怎么会