aspose file tools*
The moose likes Servlets and the fly likes how to export data to excel file in java script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to export data to excel file in java script" Watch "how to export data to excel file in java script" New topic
Author

how to export data to excel file in java script

geethareddy swarna
Greenhorn

Joined: Jul 02, 2011
Posts: 2


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: 39547
    
  27
JavaScript can't do that. You need to write server-side code (like a servlet) that generates XLS or CSV.


Ping & DNS - updated with new look and Ping home screen widget
geethareddy swarna
Greenhorn

Joined: Jul 02, 2011
Posts: 2
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: 39547
    
  27
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to export data to excel file in java script
 
Similar Threads
diasbling the parent window, until pop-up is closed
How to Export Data from JSP to Excel
merge first row of excel sheet by javascript
passing java array to javascript
how to export data to Excel