Export HTML table to Excel JavaScript function add select file name

前端 未结 2 1178
感情败类
感情败类 2021-02-13 13:15

I have the following function that exports an HTML to excel:

function generateexcel(tableid) {
  var table= document.getElementById(tableid);
  var html = table.         


        
2条回答
  •  独厮守ぢ
    2021-02-13 13:40

    There are two options which you could look into:

    • Filesaver API is new 'HTML5' functionality allowing /exactly/ this. There is just one small problem: the relevant part isn't supported yet in firefox. If you want to use this there is a nice wrapper library which makes this easier for you: filesaver.js
    • Downloadify is a flash tool which is created for exactly this as well, you can find it here. ('Disadvantage': flash)

提交回复
热议问题