1,442 questions
3
votes
1
answer
74
views
python-docx: Sections with numbered lists as content
I'm trying to create a SOP Word doc out of a JSON with the following structure:
{
"doc_id": "hydraulic-press",
"title": "Hydraulic Press",
"...
2
votes
0
answers
102
views
Python-docx add_page_break is not visible in the document
I'm trying to write a document using python-docx library. I'm adding some simple text with and then I add page_break after each paragraph. Later on, I save and open the same file again. The ...
0
votes
1
answer
66
views
How to perform multiple "render()" calls with docxtpl without losing unresolved variables?
I’m trying to fill a .docx template using the docxtpl library in Python, but I need to do it in multiple steps, because I can’t load the entire context dictionary into memory at once.
The problem is ...
1
vote
0
answers
79
views
Missing spaces between words when parsing with python-docx
python-docx has a very simple object model: Document -* Paragraph -* Run, and is very easy to work with.
However there's one showstopper issue: in some cases consequent runs (e.g. single words) do not ...
0
votes
0
answers
135
views
Word bullets and numbering using Python
I'm writing a code that transforms a Word document into a different format. Well, I've made the rest of the changes, but I'm having a problem with the numbering and bullets. I'd like to keep them. I'...
0
votes
0
answers
75
views
Setting font size for text and tables using styles approach with python-docx library
I am using the python-docx library to create a docx file that contains text and a table right after it. I want to set the text size to 12 and table size to 9 point using styles. But the size of all ...
0
votes
0
answers
107
views
Using `python-docx`, extract all tables from a specific section of a Word Document
I have the following Word File (test_doc.docx) containing multiple sections and tables. I am only interested in capturing tables from Section 2 — Here's a markdown representation of it:
Section 1
...
1
vote
1
answer
53
views
How fetch image address of word document?
I need to fetch the images adress in word document along with text and tables. Using doc.element.body loop I can't get image recognise, using doc.part.rels.values loop I can only get images. If ...
-1
votes
1
answer
120
views
Word to excel using python but preserve word format (bullet points) and structure
Script to convert word documents to excel. Works well but fails to keep structure and certain characters like bullet points.
import tkinter as tk
from tkinter import filedialog
import re
import os
...
0
votes
2
answers
92
views
python-docx header set anchor "to page"
Problem: put a logo image at top left position of the page.
I've tried the following to accomplish the same but it doesn't work as expected:
from docx import Document
from docx.shared import Mm, Pt
...
0
votes
1
answer
117
views
How to preserve text styles (bold/italic) and extract footnotes from a Word document using Python?
I’m working on a Python script to extract content from a Word document (.docx) and insert it into a SQL Server database. The challenge is that I need to preserve text styles like bold and italic, as ...
0
votes
1
answer
70
views
Changes to table with python-docx not persistent in Python 3.11
I'm using python-docx (v1.1.2) and Python 3.11.3 to work on a tool to fix a bunch of Word documents automatically. I've been able to update fonts, titles, texts, headers and footers and tables (their ...
0
votes
0
answers
44
views
Python-docx: How to force a new page when adding tables with images?
I'm generating a Word document using python-docx that contains images arranged in a table format. The document should:
Fit multiple images per page (e.g., 4x4 for word cards).
Ensure proper page ...
0
votes
1
answer
163
views
AttributeError: 'list' object has no attribute 'items'
I have been trying to write a tool to look at Word documents in a specified path for broken links.
I gave up on having it search a folder, thinking I just need to get it to do a document first. With ...
0
votes
0
answers
55
views
Table of Contents of List of Figures and Tables are not clickable in PDF while converting docx to pdf using libreoffice writer
I am using pythn-docx(https://github.com/python-openxml/python-docx) to generate a docx file and then converting this docx file into PDF format using unoconv (https://github.com/unoconv/unoconv), ...