Questions tagged [python-docx]

A python library to create, read and write Microsoft Office Word 2007 docx files.

The docx module creates, reads and writes Microsoft Office Word 2007 docx files.

Including the following features:

Creation:

  • Paragraphs
  • Bullets
  • Numbered lists
  • Document properties (author, company, etc)
  • Multiple levels of headings
  • Tables
  • Section and page breaks
  • Images

Modification:

  • Search and replace
  • Extract plain text of document
  • Add and delete items anywhere within the document
  • Change document properties
  • Run xpath queries against particular locations in the document - useful for retrieving data from user-completed templates.

For detailed information and examples, visit the python-docx documentation.

See also the official GitHub homepage.

1026 questions
-2
votes
2 answers

Unable to install Python-docx package

I tried to install python-docx package and get the error below. C:\Program Files\Anaconda3\Scripts>pip install python-docx Collecting python-docx Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by…
-2
votes
1 answer

Creating a table in python docx and use small_caps (python-docx)

This is what I have tried: from docx import Document from docx.shared import Inches from docx.shared import Pt table = document.add_table(rows= 3, cols = 1) row = table.rows[0] runner = row.cells[0].paragraphs[0].add_run('Summary') runner.bold =…
-2
votes
1 answer

Python: print each excel row as its own ms word page

I've got an excel document with thousands of rows, each row represents a person's record. How can I use Python to extract each row and write that information into an MS Word page? My goal is to create a doc containing a pseudo-narrative of each…
Che
  • 35
  • 3
-2
votes
1 answer

Automate Excel datas to a Word Document with Python

Here's my problem : I have 1000 names and addresses on an Excel Sheet and I have to write a letter on Word for every single names . Example of the letter below (red sign). I would like to automate the process by using python. Could you give me your…
jjyoh
  • 446
  • 2
  • 5
  • 17
-2
votes
2 answers

Removing  from the text

I am converting a word file to text string using Python. The resultant text string has Bullet points (in word file) converted to  (in converted string). How can I remove this from the text string using Python, so that I have only the Text string…
Srinivasan A
  • 39
  • 3
  • 11
-3
votes
1 answer

how write serial number of the docx table in python

i have many inputs and i'd like write they in .docx table with serial number def write(): table = doc.add_table(rows=1, cols=3) table.style = "Table Grid" row = table.rows[0].cells row[0].text = "name and surname" row[1].text…
1 2 3
68
69