Questions tagged [docxtpl]

python module built on top of python-docx to use docx documents as jinja2 templates

python module built on top of to use docx documents as templates

website: https://pypi.org/project/docxtpl/

57 questions
0
votes
0 answers

Image does not exist

I want to print images in word so that I can print them easier, same size, etc. I use this piece of code: from docxtpl import DocxTemplate from docxtpl import InlineImage from docx.shared import Mm import os folder = "./mercedes/" for img_name in…
user17825405
0
votes
0 answers

Can I use python-docx-template (docxtpl) to auto populate "chunks" of a word document dynamically?

I have been writing a reporting system in python and I want to generate a document based on a docx template. After researching for solutions it appears that the python-docx-template library takes in a template with a jinja2 syntax, fills in the…
0
votes
1 answer

Problem generator docxtpl flask - not work save file

I have a problem with my code. I'm trying to create a docx generator with docxtpl and flask, but I can't get it to work. My intention is to download the file generated with the information acquired from the form. Here is the code in app.py: from…
0
votes
1 answer

How write to ms word by sample?

I have ms word sample.docx like this: {{id1}} some text {{name1}} text again {{password1}} {{id2}} some text {{name2}} text again {{password2}} {{id3}} some text {{name3}} text again {{password3}} dict from code list_data = [ {"id": "1", "name":…
Юрий
  • 3
  • 2
0
votes
1 answer

Creating a report with docxtpl

I want to create a docx report with the information that I get from an excel. Lets say I have an excel like this Name Biography Age john He is a doctor. 30 michael he is an actor. 31 Lary He is a student. 22 My…
0
votes
0 answers

is there a way where i copy and paste a company address in python input and it prints as multiple line output?

I'm trying to copy & paste a company address into a python script to automate my cover letter. when I paste the address it shows up in a single line in the created word document. I want it to be in the number of lines as I copied it. from docxtpl…
ABJesary
  • 9
  • 2
0
votes
1 answer

Rescaling images in Docassemble docx template

Usually, like described here, images uploaded into DocAssemble (DA) can be put into the template with the corresponding Jinja2 tag defined in the DA YAML file like: question: | Please upload a picture of yourself. fields: - Picture:…
M.Mowe
  • 5
  • 3
0
votes
1 answer

¿How to generate a .docx document with python-docx-template (docxtpl)? Django Python

I am trying to generate a .docx document in Django for this I am using docxtpl (Python docx template) that generates documents through .docx templates. I try to generate the document with this data: listaFinal = [ [ { "-":"LIBROS" …
0
votes
1 answer

docxtpl: insert new row with borders

I have a word document page.docx containing tables and the python file file 1.py: from docxtpl import DocxTemplate doc = DocxTemplate("page.docx") context = { 'text': 'there could be your ad'} a = doc.tables for i in a: if i.cell(0,0).text ==…
0
votes
1 answer

Download docxtpl generated file with cherrypy

I am using docxtpl to generate a word document, and wondering how a user can download this file once generated using cherrypy, please see my code below. The only solution I could come up with is to save it to the www folder and create a link to the…
Ossama
  • 2,401
  • 7
  • 46
  • 83
-2
votes
1 answer

How can i create table using Docxptl in Python?

I want to create a table using docxtpl in python, where the table rows should be dynamic For eg: user_dict = [{"name": "Person 1", "age": 25, "job": "Software Engineer"}, {"name": "Person 1", "age": 25, "job": "Software Engineer"}, …
-3
votes
1 answer

Need help to make mail merge fully automated with python and without MS office installed

I am doing mail merge using docxtpl but to make it fully automated I have to make the context dynamic so I don't have to make change in code everytime for the different templates. Here is the code: import pandas as pd import os from docxtpl import…
1 2 3
4