r/JavaScriptTips • • Sep 08 '23

Word Template

Hello all,

I am still pretty new to coding in JavaScript, I was curious to know if anyone has any advice on creating a word document with existing data. I was curious to know if there was a way to use JavaScript to fill out a word template that I had created so that I do not have to do as much formatting using code.

1 Upvotes

4 comments sorted by

1

u/vordan Sep 08 '23

Have a look at Carbone, open source document and report generator. There is a cloud and a self-hosting version.

https://carbone.io/

1

u/Enough_Willingness_7 Sep 08 '23

I appreciate it! I will take a look at it. Up until today I had been trying to create the report in power automate, however I have found to many limitations for such a large report so I decided code may be the way to go.

1

u/vordan Sep 09 '23

For big reports, you should better look at some templating library like Ejs. It is a bit more complicated, but much more powerfull. You can then convert it to PDF using pdf-lib or using unoconvert, which utilizes LibreOffice (but only on Linux, I think)

1

u/Enough_Willingness_7 Sep 10 '23

Awesome I'll have to check that out and see what we can come up with.