how to save html table into excel file format using javascript in laravel -


iam trying save html(blade.php file)table excel file in laravel. javascript code

function exporttoexcel() {     var htmls = "";     var uri = 'data:application/vnd.ms-excel;base64,';     var template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.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:excelworksheet></x:excelworksheets></x:excelworkbook></xml><![endif]--></head><body><table>{table}</table></body></html>';      var base64 = function(s) {         return window.btoa(unescape(encodeuricomponent(s)))     };     var format = function(s, c) {         return s.replace(/{(\w+)}/g, function(m, p) {            return c[p];         })     };     htmls = "your html table"     var ctx = {         worksheet : 'worksheet',         table : htmls     }     var link = document.createelement("a");     link.download = "export.xls";     link.href = uri + base64(format(template, ctx));     link.click(); } 

button is

<input type="button" onclick="exporttoexcel()" value="export excel">

it works fine.

but, problem ,its works in chrome , microsoft-office:excel. not work in other browsers(ie7+, firefox etc) , open office 4(open office calc,open office math etc) software.

what iam ?? how add other softwares , browsers code??

but display "your html table".not table values.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -