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

Check if file open before save and issue warning

I'm writing a Python program using PySimpleGUI and docxtpl which writes to a Word template. I need a way to check if file is currently open by the user, and issue a warning message. Currently if the user has the Word document open when they click…
Evan Lee
  • 1
  • 2
0
votes
2 answers

Accessing Dictionary of Tab Groups

I am trying to use PySimpleGUI and docxtpl to create a GUI which will render user defined inputs into a Word Document. I would like to use TabGroup to organize the GUI, however it seems this is causing an error on doc.render(values) Traceback (most…
Evan Lee
  • 1
  • 2
0
votes
0 answers

Docxtpl adding additional .0 for number variables

I'm moving phone and ID numbers from excel to word. But docXTPL likes to add ".0" at the end of the phone number and ID numbers. How do I fix this? Many thanks! doc = DocxTemplate("Ref.docx") df = pd.read_excel('data.xlsx') I added symbols such as "…
0
votes
0 answers

How can I use docxtpl and pandas to fill a single Word file with rendered labels?

I am using docxtpl and pandas to generate a Word document that contains multiple labels created using docxtpl. I have an Excel file containing the data for the labels and a document with Jinja syntax. My goal is to generate a document that includes…
Code-Killer
  • 15
  • 1
  • 5
0
votes
0 answers

docxtpl is replacing my "&" in my word template with blanks. It is also not adding in the & from my Python code

#My code is as follows: from docxtpl import DocxTemplate adjective = "results & data-driven" doc = DocXTemplate("Resume_Template.docx") context = {'job_title': adjective} doc.render(context) doc.save("generated_resume.docx") The above ampersand…
WQureshi
  • 19
  • 3
0
votes
0 answers

Error: Unexpected : "}" using docxtpl but can't seem to find where it is in my code. Am I reading the error wrong?

I'm using Python 3.11.2 The tags I have in my word document are as follows: {{first_name}} {{last name}} My code is below creating tags to replace in a word document. I kept the tags and variables the same name for simplicity's sake. from docxtpl…
WQureshi
  • 19
  • 3
0
votes
0 answers

Picture can't be displayed when appending multiple word docs with python

I'm reading values from an excel file and putting them into placeholders on the word doc template. Each template is for one row. Trying to combine multiple word docs into one with python. Each individual doc has the picture showing. Once they are…
0
votes
0 answers

Not able to use docxtpl in buildozer for my Kivy App

Hi I am using docxtpl to update my template file in a Kivy App. But it seems that when i specify that i am using docxtpl in requirements of buildozer.spec file it is not working. Can someone help me overcome this problem either by sharing how i can…
0
votes
0 answers

docxtpl - how to append to one document instead of multiple?

I have a functioning script to generate multiple word documents based on an input of variables and a template. What I want to do is create one single word document with all of the templates appended. Here is my current code: from docxtpl import…
0
votes
0 answers

Place element at

I am using docxtpl library in Python to create new documents from a template (docx document too). I create the document, add some data then a table: from doxctpl import DocxTemplate def add_table(boss_name, employee_name, created_by): …
Juan Botero
  • 71
  • 1
  • 2
  • 12
0
votes
0 answers

Able to save as docx but not pdf

Hi I trying to save all the list as docx and pdf format, i'm able to open the file save as docx but not pdf format. Below my code import pandas as pd from datetime import datetime from docxtpl import DocxTemplate doc =…
jjbkd
  • 27
  • 4
0
votes
0 answers

RPC Server Unavailable: Printing Word Doc in Python

I am writing a Python program to print out a document. However, If I try to print something out a second time, I get an error stating 'RPC Server Unavailable" Here is my code, using win32com and docxtpl def printWordDocument(filename): …
BasedSquid
  • 11
  • 2
0
votes
0 answers

why docxtpl jinja annotate doesnt work with postgrsql?

I ve created a view to generate a doc with docxtpl, for this I use this view bellow but the annotate with Floatfield doesnt work, can you help me please ? def postACD(request, id): Raison_sociale =…
0
votes
0 answers

(Docxtpl) How to add a comment box and turn a background color becoming red for blank value

I would like to seek your help on my below issue. I have been struggling with this issue for a few days. I have a word template as shown below in docx. =============== It is expected that the "Age" value should have a comment box showing "Please…
Tony Tang
  • 47
  • 6
0
votes
1 answer

(How) can I use Jinja2's sandbox mode in python-docx-template (docxtpl)?

I would like to use docxtpl for an app that lets users autopopulate Word documents from their own Word templates. The user would be able to enter any code they want into the jinja2 fields/tags in their templates. That raises a security concern about…
Matt
  • 133
  • 1
  • 6