1

I have HTML page with table containing data. Export to excel using jquery is working fine on Firefox, But it is not working on IE.

Jsfiddle Link

HTML

<input type="button" id="btnExport" value=" Export Table data into Excel " />
<br/>
<br/>
<div id="dvData">
    <table>
        <tr>
            <th>Column One</th>
            <th>Column Two</th>
            <th>Column Three</th>
        </tr>
        <tr>
            <td>row1 Col1</td>
            <td>row1 Col2</td>
            <td>row1 Col3</td>
        </tr>
        <tr>
            <td>row2 Col1</td>
            <td>row2 Col2</td>
            <td>row2 Col3</td>
        </tr>
        <tr>
            <td>row3 Col1</td>
            <td>row3 Col2</td>
            <td><a href="http://www.jquery2dotnet.com/">http://www.jquery2dotnet.com/</a>
            </td>
        </tr>
    </table>
</div>

jQuery

$("#btnExport").click(function (e) {
    window.open('data:application/vnd.ms-excel,' + $('#dvData').html());
    e.preventDefault();
});
Bhavik
  • 4,508
  • 3
  • 25
  • 43
Mohammed Farooq
  • 227
  • 1
  • 3
  • 22
  • You might want to check [this question](http://stackoverflow.com/q/18619902/2260614) – Bhavik Jul 05 '14 at 08:09
  • it will not work usig javascript as it will not allow it to export in excel as the header will need to set in the code you need to use back end to add the headers for excels and try to export it. – cracker Jul 05 '14 at 12:11

0 Answers0