1.0.2 • Published 5 years ago

jsreport-html-to-docx v1.0.2

Weekly downloads
1
License
MIT
Repository
gitlab
Last release
5 years ago

jsreport-html-to-docx

It is custom receipe for jsreport-core to genereate docx from html template. Based on html-to-docx

Usage

const jsreport = require('jsreport-core')();
const handlebars = require('jsreport-handlebars');
const htmlDocxReceipe = require('jsreport-html-to-docx');

const fs = require('fs')

async function render(text){
    await jsreport.init();
    jsreport.use(handlebars);
    jsreport.use(htmlDocxReceipe)

    const pdf = await jsreport.render({
        template: {
            content: text,
            engine: 'handlebars',
            recipe: 'html-to-docx',
        },
        data: {
            test: 'test2'
        }
    });

    return pdf
}

render('<div><h1><span data-type="highlight" style="background-color: #ffff00;"><strong>{{test}}</strong></span></h1></div>')
    .then(res => fs.writeFileSync('./temp.docx', res.content))
1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago