Hi every body,
This is geethareddy, any body can help me how to do thecode for export htamltable to excel using java script.. very urgent please help me.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35247
7
posted
0
JavaScript can't do that. You need to write server-side code (like a servlet) that generates XLS or CSV.
Hi ULF,
I got the out put by using this code, BUt i have to change IE browser internet options like in security->customlevel->enable initialization and activex, Is there any chance to do this with out enable that option.
function toExcel(){
var xls = new ActiveXObject("Excel.Application");
xls.visible = true;
xls.Workbooks.Add;
dojo.query(".dojoxGridRowTable").forEach(function(node,index){
var x = node.rows;
for (i = 0; i < x.length; i++) {
var y = x[i].cells;
//showMessage(y);
for (j = 0; j < y.length; j++) {
xls.Cells(i + 1+index, j + 1).Value = y[j].innerText;
}
}
});
}
please give me reply....
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35247
7
posted
0
ActiveX controls are generally a security risk, and thus disabled. That's the price one needs to pay for using them.
By the way, you're aware that this code ties you to a single browser on a single operating system? Plus, the user would need to have Excel installed.