Writing a word file

Hi,

I am struggling writing a word file in VIKTOR. I have a word template, but I don’t know how to set tags in my word file. Every time I run the code I get a unadjusted template back. I already looked in the community to see if there were any questions about this issue, but I did not find the answer to my question.

Can anyone help me please? How can I set a tag in my word file?

The code I used is:

template_path = Path(__file__).parent / 'test_template.docx'
components = []
components.append(WordFileTag('test', 1))
with open(template_path, 'rb') as template:
        word_file = render_word_file(template, components)

Thanks in advance

Hi Colin,

You can find a guide on using the word file templater here: Services - render_word_file | VIKTOR Documentation

Every time I run the code I get a unadjusted template back.

Can you elaborate on how you “get the template back”? Do you use a DownloadResult for that?

ps. You can format code examples to make it more readable:

```
my code
```