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: \[code\]Object doesn't support this property or method\[/code\]\[code\]<script Language="javascript"> var tableToExcel = (function() { var uri = 'data:application/vnd.ms-excel;base64,' , template = '<html xmlns="urn:schemas-microsoft-comfficeffice" xmlns:x="urn:schemas-microsoft-comffice: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><xisplayGridlines/></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 = http://stackoverflow.com/questions/14575763/uri + base64(format(template, ctx)) } })() </script>\[/code\]
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: \[code\]Object doesn't support this property or method\[/code\]\[code\]<script Language="javascript"> var tableToExcel = (function() { var uri = 'data:application/vnd.ms-excel;base64,' , template = '<html xmlns="urn:schemas-microsoft-comfficeffice" xmlns:x="urn:schemas-microsoft-comffice: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><xisplayGridlines/></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 = http://stackoverflow.com/questions/14575763/uri + base64(format(template, ctx)) } })() </script>\[/code\]