Reputation: 53
hi everyone I'm trying to convert docx file into rtf file with python I've done lots of googling but can't found any answer I want
input = test.docx
output = test.rtf
Upvotes: 3
Views: 1751
Reputation: 311
You can use docx
module and install docx
module with this instruction : pip install python-docx
. Check the code.
from docx import Document
f = open('test.docx', 'rb')
document = Document(f)
document.save('test.rtf')
Upvotes: -1
Reputation: 103
https://pypi.org/project/pyandoc/ this may help
Let’s start with a Markdown document:
doc = pandoc.Document()
doc.markdown = '''
# I am an H1 Tag
* bullet point
* more points
* point with [link](http://kennethreitz.com)!
Now let’s convert that into a ReST document:
>>> print doc.rst
I am an H1 Tag
==============
- bullet point
- more points
- point with `link <http://kennethreitz.com>`_!
edit: read the docs
Upvotes: -1