Skip to main content

Docx file template replacing

Project description

Intended Purpose

To facilitate the substitution of reserved tags within a docx template.

This utility supports the replacement of paragraph strings, cell strings, text box strings, headers, and footers.

Furthermore, it enables the insertion of tables and images.

Requirements

pip install python-docx
pip install pandas
python3

Basic Usage

from WordWriter import WordWriter

resultsDict = {}
resultsDict["#[testheader1]#"] = "test header 1"
resultsDict["#[testheader2]#"] = "test header 2"
resultsDict["#[testString]#"] = "test strings"
resultsDict["#[testfooter]#"] = "test footer"
resultsDict["#[TX-testString2]#"] = "text box strings"
resultsDict["#[testTableString1]#"] = "cell text 1"
resultsDict["#[testTableString2]#"] = "cell text 2"
resultsDict["#[IMAGE-test1-(30,30)]#"] = "testPicture.png"
resultsDict["#[IMAGE-test2]#"] = "testPicture2.png"
resultsDict["#[IMAGE-test3-(10,10)]#"] = "testPicture.png"
resultsDict["#[TABLE-test1]#"] = "testTable.txt"

WordWriter("test.docx", "output.docx", resultsDict)

Document

Click here!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

WordWriter-3.2.1-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page