Problem in exporting web page to Excel using JavaScript?
<p>I am trying to export web (JSP) page to Excel using JavaScript. I am getting following error:</p>

<blockquote>
  <p>Automation Server can't create object.</p>
</blockquote>

<p>Here is my JavaScript:</p>

<pre><code>&lt;script type="text/javascript"&gt;

function CreateExcelSheet()
{


   var x=results.rows

   var xls = new ActiveXObject("Excel.Application")
   xls.visible = true
   xls.Workbooks.Add
      for (i = 0; i &lt; x.length; i++)
      {
         var y = x[i].cells

         for (j = 0; j &lt; y.length; j++)
         {
            xls.Cells( i+1, j+1).Value = y[j].innerText
         }
      }
     }
 &lt;/script&gt;
&lt;center&gt;&lt;button onclick="CreateExcelSheet();"&gt;Export to Excel File&lt;/button&gt;&lt;/center&gt;

  &lt;TABLE cellpadding="15" border="1" id="results" style="background-color:#6699CC" align="center"&gt;
</code></pre>

<p>Is there anything wrong in this code? I am using IE8, and also enabled Initialize and script ActiveX control not marked as safe.</p>
