Skip to main content

Performs a Mail Merge on docx (Microsoft Office Word) files

Project description

Installation with pip:

$ pip install docx-mailmerge

Usage

Read the file.

from mailmerge import MailMerge
document = MailMerge('input.docx')

List all merge fields.

print document.get_merge_fields()

Merge fields, supplied as kwargs.

document.merge(field1='docx Mail Merge',
               field2='Can be used for merging docx documents')

Write document to file. This should be a new file, as ZipFile cannot modify existing zip files.

document.write('output.docx')

Todo / Wish List

  • Make it easier to work with repeating blocks. This is currently supported, but somewhat cumbersome to work with.
  • Preserve formatting of the merge field, currently it defaults to the formatting of the containing text.
  • Image merging.

Contributing

  • Fork the repository on GitHub and start hacking
  • Send a pull request with your changes

Project details


Download files

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

Files for docx-mailmerge, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size docx-mailmerge-0.0.1.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page