On Fri, Apr 29, 2005 at 09:47:58AM -0400, Kevin Murphy wrote: > I'd like to programmatically produce printable (PDF? Postscript?) > spreadsheet-style output of database queries with these characteristics: > > * line borders around cells > * customized header and footer > * first row should be repeated on each page > * preferably, auto-sizing of columns, but not required (snip) > Are there any other options? I prefer programming in Perl (I'm pulling > data from a PostgreSQL database with a Perl script). I made some shell scripts that might do what you need. I used them to generate some LaTeX tables. It's for mysql, but you may be able to get it to work with PostgreSQL. That might be as easy as replacing mysql with postgresql on one line in the tables.sh script. The main script basically reads a file containing queries. For each it generates a table. It tries to determine what the correct column names and column widths are. If that doesn't give the desired results for a query you can override it by supplying some extra info after that query. When the table headings are alright the script feeds the query to the database engine and turns the outcome into a LaTeX table. This is turned into a pdf by pdflatex. I cleaned up my code and added some instructions to the main queries.sh script. I might need that script again a few years from now, so it helps if it's still understandable then. ;-) I'll attach the files in a tar gzipped file, but that may not survive the way to the list. If if doesn't get through, you can email me personally if you are interested in this shell+LaTeX solution. HTH, -- Maurits van Rees | http://maurits.vanrees.org/ [Dutch/Nederlands] Public GnuPG key: keyserver.net ID 0x1735C5C2 "Let your advance worrying become advance thinking and planning." - Winston Churchill
Attachment:
dblatex.tar.gz
Description: Binary data
Attachment:
signature.asc
Description: Digital signature