GSoC 2020: CiviCRM Mail Merge in LibreOffice

Közzétéve
2020-06-26 11:36
Written by
asha - member of the CiviCRM community - view blog guidelines

Hi everyone! Thank you for visiting the blog post. I’m Asha Sulaiman from Sri Lanka. I’m a final year undergraduate at University of Moratuwa following the Information Technology and Management degree programme. Currently I’m a student developer at CiviCRM working on the project integrating CiviCRM with LibreOffice in order to perform the mail merge operation.

Mail merge is a most beneficial feature if you want to create many similar documents in which the formatting and much of the text are the same, but one or more things are unique for each document such as name, address etc.  To achieve this task, the project aim is to develop an extension to write a letter to a contact/contacts with LibreOffice instead of using PDF-letter.  There are many benefits you can obtain by using this extension, 

  • You can directly upload a LibreOffice writer document with necessary tokens to perform the mail merge operation.
  • Image resolution will not reduce in the merged document.
  • Merged file will not be corrupted. 
  • You can edit the merged document as per your wish.

However from my mentor’s guidance I have found an already developed extension which does a similar task using Microsoft Word instead of LibreOffice (https://github.com/veda-consulting-company/uk.co.vedaconsulting.module.wordmailmerge) and this has changed my project direction.  The most beneficial part of open source is that we don’t want to build everything from scratch. If we found some already inbuilt open source solutions we can use it, build on top of it to make it more powerful. So we plan to enhance the extension which not only works with Microsoft Word and LibreOffice Writer but also to work with Microsoft Excel and LibreOffice Calc too. 

As the initial step I tried to make the word mail merge extension work with CiviCRM latest version 5.26.0. As this breaks in the latest releases I made a contribution to resolve this issue. (https://github.com/veda-consulting-company/uk.co.vedaconsulting.module.wordmailmerge/pull/27)

In the second week with my mentor's guidance I enhanced the extension to make the integration between CiviCRM and LibreOffice Writer to perform the mail merge operation.   

How to install the extension

  1. Pull the latest release from https://github.com/veda-consulting-company/uk.co.vedaconsulting.module.wordmailmerge.
  2. place the folder inside your configured extensions directory.
  3. When you reload the Manage Extensions page the new “Word Mail Merge” extension should be listed with an install link.
  4. Proceed with install.

Setup

  1. Create your own Template LibreOffice Writer document using the necessary tokens.
  2. Navigate to 'Mailings'->'Message Templates'.
  3. Click 'Add Message Template'
  4. Give a name for your new template in the 'Message Title' field in the New Message Template form.
  5. Click the 'Upload Document' radio button in the Source section.
  6. Attach your odt template in the 'Upload Document' section.
  7. Select the LibreOffice template from the mail merge drop down and tick the ‘Enabled ?’ checkbox.
  8. Click save

Usage

I would like to take this opportunity to thank my mentor Parvez Saleh for his constant support and guidance.

If you have any feedback or suggestions, that would be much appreciated :)

Filed under

Comments

Thanks Asha! This sounds like a useful addition to CiviCRM.

Thanks Asha. I think you are working on a nice addition to CiviCRM.