function exporttoexcel(){
var i;
var j;
var mycell;
var tableID = "crtfdetails";
var objXL = new ActiveXObject("Excel.Application");
var objWB = objXL.Workbooks.Add();
var objWS = objWB.ActiveSheet;
for (i=0; i < document.getElementById(tableID).rows.length; i++)
{
for (j=0; j < document.getElementById(tableID).rows(i).cells.length; j++)
{
mycell = document.getElementById(tableID).rows(i).cells(j)
objWS.Cells(i+1,j+1).Value = mycell.innerText;
}
}
objWS.Range("A1", "Z1").EntireColumn.AutoFit();
objXL.Visible = true;
}