25 December 2005

Mailmerge in openoffice 2

In my head, to do mailmerge we need template and datasource. Place the mail merge field in the template and point the field to appropriate datasource field/column.

I spent this christmas evening with trying a script to mailmerge using pyuno, found in the openoffice forum. What I want to do is, produce a single openoffice file after mailmerge from a datasource(a csv file). I manage to do it after modify the code. Hooray!

I had refer to the api, and read a java code snippet.

What annoying me is when export the merged file to pdf, extra unwanted blank pages will be produced for odd-numbered page. Let say I have 1 page template then want to mailmerge with 3 set of data. The result is 5 pages of pdf. The second and fourth page is fill with unwanted blank page. I had tried using openoffice 2 in my Windowx XP box and FreeBSD 6.0 box, both produce same result. Is it a feature/a bug? What I know, this really annoy me :(

Some of openoffice users also complaints about memory usage for mailmerge.

Actually, I had implemented mailmerge using another approach. Modify the openoffice xml file (to be specific, modify content.xml) using ooopy. Although my script able to do the mailmerge, it really painful to get it work. Manipulate openoffice xml using dom really make me headache. No benchmark for these two approaches, what I want is just to mailmerge. Duhh.

1 comment:

Anonymous said...

>Modify the openoffice xml file (to be >specific, modify content.xml) using ooopy.
damn ... I've reinvent the wheel. modify content.xml in php and then convert it to pdf using jooconvertor[1]. nice info :)

[1]:http://jooreports.sourceforge.net/