0

First, I have to fetch the data from database using PHP and MySQL.
Then, I am displaying the contents in a table.
Finally, I use Javascript to export the table contents to excel.

It's working fine in all browsers except IE.

The error I receive in IE is: Object doesn't support this property or method

<script Language="javascript"> var tableToExcel = (function() { var uri = 'data:application/vnd.ms-excel;base64,' , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet‌​}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:Excel‌​Worksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><t‌​able>{table}</table></body></html>

, base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) } , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) } return function(table, name) { if (!table.nodeType) table = document.getElementById(table) var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML} window.location.href = uri + base64(format(template, ctx)) } })() </script>
عثمان غني
  • 2,786
  • 4
  • 52
  • 79
  • 7
    please provide code sample – abc123 Jan 29 '13 at 04:41
  • – user1921051 Jan 29 '13 at 04:46
  • , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) } , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) } return function(table, name) { if (!table.nodeType) table = document.getElementById(table) var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML} window.location.href = uri + base64(format(template, ctx)) } })() – user1921051 Jan 29 '13 at 04:47
  • can you update these to the question itself and if possible provide a [jsfiddle](http://jsfiddle.net/) – AurA Jan 29 '13 at 04:50
  • hi justin, thank you for your reply... i have provided sample code... – user1921051 Jan 29 '13 at 04:51
  • But you need to proper it thus we can able to see and understand your code...plz proper it..can you..?? – GautamD31 Jan 29 '13 at 04:52
  • yes gautam, i did. am struggling more because i tried more than my level best but no improvement... so please help me to resolve this. i have written my JS code... – user1921051 Jan 29 '13 at 04:58
  • Your code lacks the closing quote from the end of `template` and a bunch of semicolons after `format`. Please, try to indent the code, it's unreadable as it is now. – Teemu Jan 29 '13 at 05:46
  • SAME Issue: http://stackoverflow.com/questions/18286745/iexplorer-script438-object-doesnt-support-property-or-method-btoa – ErickBest Aug 17 '13 at 09:02

0 Answers0