20
Sep
Written by: Jonathan Maron. Stored in: Templates.
Lucas Mbiwe, over at the LiveDocx Blog, has just published a blog post that illustrates how to generate templates in OpenOffice.org (OOo). If you wish to create templates in OOo, please read this text:
His tutorial is relevant to OOo 2.4, 3.0 and 3.1.
I would like to draw special attention to the last paragraph of his text.

Although the merge field names in the above template appear to be:
- LiveDocx.letter.recipient
- LiveDocx.letter.sender
i.e. with a period as path separator, they are in fact:
- LiveDocxÿletterÿrecipient
- LiveDocxÿletterÿsender
i.e. with the character ÿ as path separator.
When assigning data to the template, you must use the notation with ÿ and not a period. For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | $mailMerge = new Zend_Service_LiveDocx_MailMerge(); $mailMerge->setUsername('myUsername') ->setPassword('myPassword'); $mailMerge->setLocalTemplate('template.docx'); $mailMerge->assign('LiveDocxÿletterÿrecipient', 'Sam Johnson') ->assign('LiveDocxÿletterÿsender', 'Peter James'); $mailMerge->createDocument(); $document = $mailMerge->retrieveDocument('pdf'); file_put_contents('document.pdf', $document); |
The method getFieldNames() correctly returns the field names with ÿ as path separator.