I have a simple table which I would like to export to an Excel file on click of a button.
I wrote a function in JavaScript, but I am not sure what is going wrong.
function CreateExcelSheet() { var x=myTable.rows var xls = new ActiveXObject("Excel.Application") xls.visible = true xls.Workbooks.Add for (i = 0; i < x.length; i++) { var y = x[i].cells for (j = 0; j < y.length; j++) { xls.Cells( i+1, j+1).Value = y[j].innerText } } } This is the button on the JSP page:
</table> <input type="button" onclick="CreateExcelSheet()" value="Export"></input> </form> It used to work earlier but it is not working now. Is there any other way to do this?