Docx templates to generate documents in GO

I am new to GO and have recently starting learning about it. I wanted to know if there is any libraries or projects which help you do templating in GO. My Scenario is that I have docx templates in which jinja2 type syntax are there . I have a REST API which receives JSON as input and is passed to the templating engine to produce the docx documents using the docx templates.

I wanted to know if is possible using docx templates. I saw a lot of examples in templates feature of GO using html templates but not sure if it will work similar on docx templates.

Can anyone guide me or suggest about this please.

1 Like

Maybe you can find something in GitHub - avelino/awesome-go: A curated list of awesome Go frameworks, libraries and software

1 Like

There is a library for simple cases: GitHub - lukasjarosch/go-docx: Replace placeholders inside docx documents with speed and confidence.

But since docx is a very very complex format with a lot of corner cases, there is no all-in-one complete templating engine in go as far as I know.

In these cases it can be the best way to call some command line tool or C library directly from your go code, if good solutions exists in other languages.

1 Like