Search the OOo Forum. This should get you started anyway.
http://www.oooforum.org/forum/viewtopic.phtml?p=76328
I think that I have an example somewhere, if I can only find it.
Matthias Benkmann wrote:
I'm writing an application that creates CSV-files and automatically
loads a text template for the
I'm writing an application that creates CSV-files and automatically
loads a text template for the mail merge function. The mail merge
fields in the template are connected with a text database that refers
to the directory where the CSV files are created.
Because it must be possible to open multiple