I do stuff like this with LaTeX directly, though I do design the files in LyX and then pull them into Perl :-)-O
There there is also a LaTeX package to pull in CSV files, but forgot what its name is :-)-O el On 2012-04-05 21:20 , John O'Gorman wrote: > : >> On 04/04/2012 02:25 AM, "Jörg Kühne" wrote: >>> Dear List >>> >>> Is it possible to write (with Lyx) a circular letter with an >>> arbitrary letter pattern? > I have written perl programs which allow mail merge in insurance > companies for things such as renewal notices, price quotation, etc. > The main idea is that the user creates a normal LyX letter template > (using the article class - we found the letter classes were not suited > to NZ conventions). Where details particular to a client were to be > inserted, you put perl expressions e.g. ${title} ${firstname} > ${lastname} etc. > > A database program runs an SQL query and, for each row returned, builds > list of perl assignments > e.g. > ${firstname}="John"; > ${lastname}="Smith"; > ... > and writes these to a file with a .rec suffix > Then the lyxmerge program loops through the .rec file, effectively > assigning the database values for each client then reads the template > and writes to an output file. Works beautifully giving the usual superb > typesetting. > > Perl is most suitable for this because of its weird notion of using > distinctive syntax for variables. More pleasant languages like Python > do not. > > When I wrote this many years ago, I also took the trouble to create > scripts to insert tables of data into the template. This involved using > some supplied perl library scripts which came with LyX. > The LyX developers now use python for this sort of thing and I haven't > kept my scripts up to date with current LyX versions. > > If you want more detail, I'll happily pass on the scripts to those who > want them. > > John O'Gorman > > > > > >