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.
At a Glance
An overview of API.
- Document Object Model
- LINQ Reporting Engine
- PNG, JPEG, BMP, GIF
- XPS, OpenXPS
- PDF, PDF/A-1a, PDF/A-1b
- PostScript (PS)
- XamlFixed, XamlFlow or XamlFlowPack
Python Word API supports all major platforms including the following.
- Windows 7 (x64, x86)
- Windows 8, 8.1 (x64, x86)
- Windows 10 (x64, x86)
- and others
- and others
Supported File Formats
Aspose.Words for Python via.NET supports the popular Word Processing file formats listed below.
- Microsoft Word: DOC, DOCX, RTF, DOT, DOTX, DOTM, DOCM FlatOPC, FlatOpcMacroEnabled, FlatOpcTemplate, FlatOpcTemplateMacroEnabled
- OpenOffice: ODT, OTT
- WordprocessingML: WordML
- Web: HTML, MHTML
- Fixed Layout: PDF
- MOBI, TXT
- Fixed Layout: PDF/A, XPS, OpenXPS, PostScript (PS)
- Images: TIFF, JPEG, PNG, BMP, SVG, EMF, GIF
- Web: HtmlFixed
- Others: PCL, EPUB, XamlFixed, XamlFlow, XamlFlowPack
Advanced Python Words API Features
You can try some of the popular Aspose.Words features on the online application pages:
Remove a single page or multiple pages from a document
Delete blank pages in documents
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.
- Compatible with Python 3.5, 3.6, 3.7, 3.8 and 3.9
- In case you write Python code on Linux, have a look at additional requirements for Linux
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 doc.save("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 doc.save("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.
We were looking for an easy to use and class leading simple to integrate PDF generator to integrate into our product. Aspose.Words was exactly what we were looking for. Stuart Ives | Smartmatching UK LTD, UK
Currently we are using Aspose.Words for .NET for generating our invoices, receipts, pay slips and we intend to make it as ‘the platform’ for all our word processing needs of SCINTRA. Meyyappan Anna | SCONCEC, USA
Aspose.Words for .NET is very easy to use and integrate into our product. As a result we were able to deliver our project on time and to the satisfaction of our customers. Hajindar Singh | Simulation Software & Technology , Singapore