How to use the html-to-xlsx.XlsxPopulate function in html-to-xlsx

To help you get started, we’ve selected a few html-to-xlsx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jsreport / jsreport-html-to-xlsx / lib / mergeXlsx.js View on Github external
const util = require('util')
const fs = require('fs')
const XlsxPopulate = require('html-to-xlsx').XlsxPopulate
const getXlsxStyleNames = require('html-to-xlsx').getXlsxStyleNames
const toArray = require('stream-to-array')
const writeFileAsync = util.promisify(fs.writeFile)
const toArrayAsync = util.promisify(toArray)

module.exports = async (reporter, request, response) => {
  let xlsxTemplateBuf
  let tableXlsxBuf

  reporter.logger.debug('Merging html-to-xlsx result into xlsx template is starting', request)

  if (response.stream.path == null) {
    throw reporter.createError('No path was found in xlsx response stream', {
      weak: true
    })
  }