Skip to content

jsreport/jsreport-xlsx

Repository files navigation

⚠️ This repository has been moved to the monorepo jsreport/jsreport

jsreport-xlsx

NPM Version Build Status

jsreport recipe which renders excel reports based on uploaded excel templates by modifying the xlsx source using predefined templating engine helpers

See the docs https://jsreport.net/learn/xlsx

Installation

npm install jsreport-xlsx

jsreport-core

var fs = require('fs')
var jsreport = require('jsreport-core')()
jsreport.use(require('jsreport-xlsx')())
jsreport.use(require('jsreport-handlebars')())

jsreport.init().then(function () {
  return jsreport.render({
    template: {
      recipe: 'xlsx',
      engine: 'handlebars',
      content: '{{{xlsxPrint}}}',
      xlsxTemplate: {
        content: fs.readFileSync('Book1.xlsx').toString('base64')
      }
    }
  }).then(function (report) {
    report.stream.pipe(fs.createWriteStream('out.xlsx'))
  })
})