When import docx in python3.3 I have error ImportError: No module named 'exceptions'

when I import docx I have this error: File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/docx-0.2.4-py3.3.egg/docx.py", line 30, in <module> from exceptions...

How to convert .doc files to HTML?

I have a bunch of .doc files (not .docx) and I want to convert them into HTML files. I tried Python's docx2html module too but it only supports .docx files and not doc. So how can I achieve it?

How to use python-docx to replace text in a Word document and save

The oodocx module mentioned in the same page refers the user to an /examples folder that does not seem to be there. I have read the documentation of python-docx 0.7.2, plus everything I could find...

Removing Paragraph From Cell In Python-Docx

I am attempting to create a table with a two row header that uses a simple template format for all of the styling. The two row header is required because I have headers that are the same under two...

How to install cffi package on AWS Beanstalk

This question looks the same as this post, but since there was no answer, I am re-asking here. I have a Django project to be deployed on AWS Beanstalk, which is using a package cffi. When I run eb...

Cant apply table style in word doc using docx python

I cannot apply a custom table style to a WORD doc using python 3.4. I followed a great method by @scanny: I created a blank WORD doc, created a custom table style and saved it as "OR". I created a...

Python docx Replace string in paragraph while keeping style

I need help replacing a string in a word document while keeping the formatting of the entire document. I'm using python-docx, after reading the documentation, it works with entire paragraphs, so I...

Extract image position from .docx file using python-docx

I'm trying to get the image index from the .docx file using python-docx library. I'm able to extract the name of the image, image height and width. But not the index where it is in the word...

Python-docx, how to set cell width in tables?

How to set cell width in tables?, so far I got: from docx import Document from docx.shared import Cm, Inches document = Document() table = document.add_table(rows=2, cols=2) table.style =...

extract text from .doc (not docx)

I checked mose question and answers in stackoverflow and others there is many way to open and read the .docx file not doc by using python I already checked python-docx library but it only support...

Convert PDF to .docx with Python

I'm trying very hard to find the way to convert a PDF file to a .docx file with Python. I have seen other posts related with this, but none of them seem to work correctly in my case. I'm using...

Retrieving font style, size and other attributes from a word document

I am working with python 3.6, my question is that is it possible to retrieve information from an existing document such as the font name of the text, the font size,etc. I have tried using...

Python Docx line spacing for specific paragraph

Having looked through the docs, I am trying to figure out how to apply line spacing to a single paragraph, but it appears that any line spacing can only be done on a global scale using styles. Is...

How use python-docx to stream a file from template

Ok so right now I have a function in my django app that creates a word document like so: def form_view(request): if request.method == 'POST': #do a bunch of things context = { ...

Python Docx - how to number headings?

There is a good example for Python Docx. I have used multiple document.add_heading('xxx', level=Y) and can see when I open the generated document in MS Word that the levels are correct. What I...

issue when calling libreoffice for pdf generation from python of docx with charts

using debian 9.5, python 3.5, libreoffice 5.2, x86_64 arch. I have a word file (docx) of 22 pages, which contains several charts. When run from terminal using bash, the following command works...

In python-docx how do I delete a table row?

I can't figure out how to delete a table row in python-docx. Specifically, my tables come in with a header row and a row that has a special token stored in the text of the first cell. I search for...

Convert PDF to docx

How can we convert a PDF to docx with/without using python. Actually I want to automate conversion of large number of file, so I need an API. I have used online websites...

Adding a link to a bookmark in MS Word using python docx library

I've used the code from an earlier question to create a hyperlink: https://stackoverflow.com/questions/47666642/adding-an-hyperlink-in-msword-by-using-python-docx/47666747 I now want to create a...

Facing issues while trying to access a file of type docx stored in aws-s3 bucket with the help of python-docx

I have a docx file at my aws-s3 bucket. I need to read it use python-docx. I write this: from docx import Document document =...

Tika parser python with Docker giving RuntimeError: Details: Unable to start Tika server

Without Docker the scripts are able to parse the pdf files using tika. But however when I'm trying with Docker..I get the following error for the tika server not running: with some reading I tried...

Send email based on print output - Python

I have written a script with will check .docx file format in a particular format and give me the output on print function. import glob if glob.glob('//gbhfrd01/directorates/Business...

How do I create a PDF file containing a Signature Field, using python?

In order to be able to sign a PDF document using a token based DSC, I need a so-called signature field in my PDF. This is a rectangular field you can fill with a digital signature using e.g. Adobe...

Docker python tika

I like to create a Dockerfile that installs all the necessary components to run python-tika inside a Docker container. So far this is my Dockerfile: ###Get python FROM python:3 RUN pip3 install...

Convert doc/docx to pdf in AWS Lambda?

Tried: Premade Lambda application docx to pdf (the application is no longer deployable) https://github.com/NativeDocuments/docx-to-pdf-on-AWS-Lambda Installing comtypes.client and win32com.client...

Set background color (shading) on normal text with python-docx

There are plenty of SO threads for setting background color in tables, but I'd like to change color for a piece of normal text in a paragraph. I'm able to set the highlight color, but then I can...

extremely slow add a table to python-docx from a csv file

I have to add a table from a CSV file around 1500 rows and 9 columns, (75 pages) in a docx word document. using python-docx. I have tried differents approaches, reading ths csv with pandas or...

Convert DOCX Bytestream to PDF Bytestream Python

I currently have a program that generates a .docx document using the python-docx library. Upon completing the building of the .docx file I save it into a Bytestream as so file_stream =...

use UTF-8 in docxtpl (DocxTemplate) and Jinja2

I am generating docx documents by using docxtpl and Jinja2. I produced it by using as explained in the manual a python matrix/dictionnary feeded by data from XML files. When XML files store...

Running into an error when trying to pip install python-docx

I just did a fresh install of windows to clean up my computer, moved everything over to my D drive and installed Python through Windows Store (somehow it defaulted to my C drive, so I left it...

Relevant tags