elapouya / python-docx-template

Use a docx as a jinja2 template
GNU Lesser General Public License v2.1
1.92k stars 378 forks source link

Create richtext from commandline execution #531

Open effem opened 3 months ago

effem commented 3 months ago

Describe your problem

I'm calling docxtpl from another programm (as described here https://docxtpl.readthedocs.io/en/latest/#command-line-execution) and try to pass some variables that contain newlines but defining the variable in the word template is not sufficient to turn it into rich text.

Provide a test case

Example JSON:

{
  "text": "This is a text\n\n with newlines!"
}

Example code in the docx: grafik

Is there a possibility to create rich text without creating a rich text object in python and passing it as context?