Wednesday, October 9, 2013

LibreOffice Mail Merge hidden paragraphs

Oh what fun. Why is it always so difficult ? Do devs never use the tools they build ?

Wanted to do a merge document but hidden paragraphs are a pain in the backside.


Say we have a Data Source (for ease I just create a new db from a Spreadsheet - then you can add and change data in the sheet easily) :

Accountants_Solicitors

So we want

Name
Address1
Address2
Address3
Address4
Address5
City
County Postcode

Not all lines are used so we want to lose blank lines.


When we add our fields we get this - we can add a normal Para at the end of the line :

[Accountants_Solicitors.Sheet1.Name]
[Accountants_Solicitors.Sheet1.Address1]
[Accountants_Solicitors.Sheet1.Address2]
[Accountants_Solicitors.Sheet1.Address3]
[Accountants_Solicitors.Sheet1.Address4]
[Accountants_Solicitors.Sheet1.Address5]
[Accountants_Solicitors.Sheet1.City]
[Accountants_Solicitors.Sheet1.County] [Accountants_Solicitors.Sheet1.Postcode]

To hide a line put the hidden paragraph at the START of the line :

[Hidden Paragraph][Accountants_Solicitors.Sheet1.Address4]

Now, you can edit the 'Condition' of the hidden paragraph to decide when the line is hidden :

![Accountants_Solicitors.Sheet1.Address4]





If you manually do your labels then don't forget the next record field at the end of each address.


Job done...... just don't ask me how they dreamt it up, especially the 'non printing' pages grrrrrrrr........

No comments:

Post a Comment