Improving Mail Merge in LibreOffice using NLG Techniques

As part of the Workshop NLG FaMAF 2011, I took to myself to investigate NLG-inspired improvements to LibreOffice mail-merge capabilities.

So far, I found that LibreOffice mail-merge is "row oriented", meaning that each document corresponds to a row in the source database source.

As such, it currently cannot fulfill a "owed items to a library" use case scenario. I have decided to look into improving LibreOffice mail-merge to support that case.

The Scenario


Table Users

  • ID
  • Name
  • Gender
  • Address

Table Items

  • ID
  • Title
  • Borrowed?
  • Return Date
  • Borrower ID

Expected template

pre-condition for generation: for:all/Users:user such:that exists/Items:item such:that item.borrowerID == user.ID :and: item.returnDate > currentDate



Dear {user.name},

Please note the following item(s) are overdue and should be returned:

{for:each/Items:item such:that item.borrowerID == user.ID :and: item.returnDate > currentDate }

  • {item.title} due date: {item.returnDate}


Yours truly,

Your local library.