Aspose.Words  for Python

Python API to Process Word Documents

Create, edit, render and convert Word files to multiple formats using Python. Also generate reports and visualize your data. All this without using external software.

  Download Free Trial

Aspose.Words for Python via .NET is a package, designed to read and manipulate documents of various types, with a primary focus on Microsoft Word (DOC, DOCX, ODT), PDF, and Web (HTML, Markdown) documents. Our library contains more than 100 Python classes to handle low-level operations behind document processing and data formatting. Thus, Aspose.Words enables Python developers a unique opportunity to implement script-based document automation.

With the advent of powerful computer hardware in the last decades, Python has become a programming language widely used in web development (Django, Flask, Pyramid frameworks), scientific tasks, and data analytics. The usefulness of Python derives from a vast ecosystem of third-party packages. Supplied with a great number of progressively developing libraries, Python is considered to be the best choice for rapid software development.

Aspose.Words team decided to keep up with the latest programming trends and supply Python community with professional software to process DOC, DOCX, PDF, RTF, DOT, DOTX, DOTM, DOCM, FlatOPC, ODT, OTT, HTML, MHTML, MOBI, TXT, XPS, PS, TIFF, JPEG, PNG, BMP, SVG, EMF, GIF, PCL, EPUB, XML, XAML and other file formats. You can see the full list of supported formats.

Note: according to TIOBE Programming Index, which reflects the popularity of programming languages, Python today is a programming language number one.

Functionality of Aspose.Words for Python via .NET

Aspose.Words is a self-contained Python library. You do not need to install any office suite to get your Python code working. This Python API relies on the Document Object Model (DOM) to access document nodes and elements.

Advanced Python Words API Features

You can try some of the popular Aspose.Words features on the online application pages:

You can try all Aspose.Words online applications.

Also check out the documentation for the most popular Aspose.Words features:

Please note that the list is not complete and you can find more features and descriptions in the documentation.

System Requirements

How to Install the Python Library

Use pip to install our Python library for Word document processing from the PyPI repository:

How to Install Aspose.Words for Python via .NET

pip install aspose-words

Edit Word documents in Python

The following code example shows how to create a blank document, insert text into it and save the result as PDF:

Create a Document and Save it to PDF – Python

import aspose.words as aw

# Create a blank document
doc = aw.Document()

# Use a DocumentBuilder instance to add content to the document
builder = aw.DocumentBuilder(doc)

# Add a paragraph to the document
builder.writeln("Hello World!")

# Save the result as a PDF document. The output format is determined by the file extension"Output.pdf")

Convert Word documents in Python

You can easily convert files from one format to another. Do you know how to extract text from Word documents via Python? The following code sample shows how to do it with a single line of code by converting DOCX to HTML:

Convert DOCX to HTML – Python

import aspose.words as aw

# Load a document from the local drive
doc = aw.Document("Input.docx")

# Save the output as hypertext"Output.html")

See the Conversion section for more details.

What People Are Saying

Don't just take our word for it. See what users have to say about Aspose.Words APIs.

View Case Studies

Support and Learning Resources