I need a way for my website to be able to read (use) Word files and Mail Merge the fields in it with data from my website. The documents will be letters and cheques.

Ideally I would have the Word document saved in a folder on my computer (or server) and have the website use this file, merge the data (name, prize) and print it. We have facilities to do all of this but the editor is awful that I'm using and I can't find one similar to Word.

Thanks for your help in advance and pls ask any questions if needed

EDIT: The website is hosted on my server (works server but it's there own)

I'm willing to pay relatively good. It's for my works business so willing to pay for the right software.

I'm not sure what it can plug into if I'm honest (Sorry!)

  • 2
    What is your website hosted on? What else do you have in your website that this software can maybe 'plug into'? What are you willing to pay? Pls edit into your question.
    – user416
    Mar 14, 2016 at 14:36
  • Would Office Open XML work by any chance? I'm unsure of how it works though
    – JakeMando
    Mar 14, 2016 at 15:09
  • Maybe of help: stackoverflow.com/questions/12959867/…
    – Doc Brown
    Mar 14, 2016 at 19:36
  • @JakeMando You will need some kind of programming tool to be running on your back-end, on the server side, such as Java. The comment from Doggen is asking you to spell out kind of programming tools/environments may be available to you. Mar 20, 2016 at 6:54
  • Also note that allowing Word documents on your server, as well as software that handles them, increases your vulnerabilities manyfold - so your server security needs to be really good. You may want to include security requirements into your question as well.
    – user416
    Apr 19, 2016 at 15:37

2 Answers 2



LibreOffice is an open-source free-of-cost office suite competing against Microsoft Word and Excel.

LibreOffice offers an API through which you can programmatically manipulate the app. This API is implemented in various languages including Java, C++, and Python.

This API provides acces to much of the app’s functionality. You may be able to invoke mail-merge features.


As Basil said, you can use the Libre Office API directly and even from the command line to change contents and do format conversions (to PDF for example). JODReports (open source) and Docmosis (commercial) sit above this API to allow mail merge functionality with a bit more power. Please note I work for Docmosis.

A blog showing how to use the Libre Office API (UNO) from Java is here: Java Convert Word to PDF . That particular blog shows some simple mail merging using the UNO API of Libre Office (no need to use Docmosis or JODReports). If you change the code to output Word format instead, it becomes the mail merge functionality for which you were searching. The ideas are helpful even if your web server is not Java-based.

You can also manipulate both Libre Office and Office Open XML files yourself as you said. It's not trivial but if you can do some programming or have a programming team and your requirements are simple you can probably do it yourself. The process is:

  1. unzip the Office file (eg docx)
  2. manipulte the files you need to (text substitution etc)
  3. zip up to a new file (creating the final docx)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.