Is there a good library for generating HTML-style tables with the equivalent
of colspans, automatically sized columns, etc. that can render directly to
I'm re-doing a big chunk of locally-written code. I have a
report-generating function that takes a list of lists of lists as input and
returns either a PDF, an HTML table, or an Excel spreadsheet as requested.
For example, input might look like:
headers=['Invoice number', 'Customer', 'Price'],
[['123', 'John Doe', '$50.00'],
['Ordered on 2008-01-01 via the website']],
[['124', 'Peter Bilt', '$25.99'],
['Mail via African swallow']]
This would result in HTML like:
<td colspan="3">Ordered on 2008-01-01 via the website</td>
<td colspan="3">Mail via African swallow</td>
Note particularly how the explanatory notes for each invoice are similar in
appearance to the "primary" report lines they're associated with.
Now, I have a similar transformation to PDF via pdflatex. This works fairly
well but requires a bunch of temp files and subprocesses, and I've never
been 100% happy with the LaTeX output (you have to calculate your own
column widths, for instance). Since I plan to re-write this anyway, I'd
like to find a more widely used library if one was available.
ReportLab seemed *almost* perfect, except that it doesn't support colspans.
As I hope I demonstrated in the example, most of our reports depend on that
So, again, any thoughts on a PDF generator that can generate tables with the
same kind of flexibility as HTML?