导出ta'b'le

161 阅读1分钟

导出ta'b'le---

主题列表:juejin, github, smartblue, cyanosis, channing-cyan

import FileSaver from 'file-saver'

import XLSX from 'xlsx' exportExcel () { /* generate workbook object from table */ var xlsxParam = { raw: true } // 导出的内容只做解析,不进行格式转换 var wb = XLSX.utils.table_to_book(document.querySelector('#exportTab'), xlsxParam)

  /* get binary string as output */
  var wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
  try {
    FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), '审核情况表.xlsx')
  } catch (e) {
    if (typeof console !== 'undefined') {
      console.log(e, wbout)
    }
  }
  return wbout

}

贡献主题:github.com/xitu/juejin…

theme: juejin highlight: juejin