how to create nice HTML tables in reports?

Christian Stimming stimming@uclink.berkeley.edu
Sun, 21 Jan 2001 01:59:16 -0800


-----BEGIN PGP SIGNED MESSAGE-----

I would like to (re)write a profit-and-loss report, probably in the next 
week or so because I need it. But I am unsure on how to achieve a nice 
looking hierachical account list for the report. I mean, the result should 
look like the once existing pnl-report: 

Assets                                 $500
   Cash                    $100
   Checking Acc.       $400
   ...

The existing reports (balance-and-pnl, taxscf) achieved this with a lot of 
 's, which is essentially this kind of table:

+-------------+----+----+
|Assets                  |         | $500 |
+-------------+----+----+
|  Cash          | $100 |         |
+-------------+----+----+
|  Checking    | $400 |         |
 ...

Is this the only/best/easiest way to get the desired output? One 
alternative I thought about is to break the first column into several 
(invisible) columns and to work with different colspan's. (This makes the 
assumption that the cell borders are set to zero, i.e. <table border=0>, 
an assumption that I think is reasonable for any report that is to be 
printed.) That could mean

<tr><td colspan=2>Assets</td>...</tr>
<tr><td></td><td>Cash</td>...</tr>
<tr><td></td><td>Checking</td>...</tr>

I think this solution looks a bit more sound than the rather ad-hoc 
insertion of &nbsp;'s. But you still have to determine the width of this 
very first column. The homepage-hacking way of that task is to have one of 
the infamous one-transparent-pixel-gif images, enlarged to the desired 
size, in one cell of that column... not very sound either...

Another problem concerning the tables in the reports is the vertical 
spacing between rows. It turns out that this spacing is not going to be 
constant over one table, but instead you might want a larger vertical 
space between your "Assets" and "Liabilities" account rows as compared to 
the space between, say, the "Checking A" and "Checking B"  rows. The 
balance-and-pnl report inserts empty table rows for achieving this, i.e.

...$42.42</td></tr>
<tr></tr>
<tr><td>Liabilities...

which, again, seems rather like an ad-hoc approach. This gives the desired 
spacing only for the current gtkhtml implementation (which might change) 
and/or the designer's favorite HTML browser (for printing -- at least 
that's what I did). Also, changing the table's cell padding/spacing 
doesn't help because the spacing is not constant for all rows. The spacing 
might also be different for rows and columns -- rows might require more 
spacing while columns need less spacing (paper is never wide enough for 
your table).

Conclusion: The standard HTML table options are not sufficient for 
creating a good-looking report, at least not good-looking after printing. 

What extensions to standard HTML (version 3, isn't it) are there in sight 
to give the report developer a greater variety of spacing possibilities? 

a) I know CSS could solve this, but AFAIK CSS support of gtkhtml will not 
be available soon, if ever.

b) I have worked with a lot of invisible tables and 
one-transparent-pixel-gif images. I know this can give any design you 
want, but it's a heck of a hack...

c) We could stick to &nbsp;'s and empty rows <tr></tr> but those are 
nearly as incompatible as b) ...

d) others?

Christian

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBOmqy9WXAi+BfhivFAQF8YQQAh3srHl3U12fDdwBVrrFgIUIL/lKWgLRG
efCS7ZKxUOYZWXTDYJ2ChjlgYdCPt7CGsBHbEgq7i+9Z7/oCivX+Ms6JuCU+EgeP
4a9hsZJSzwM5uKM/LQE7AyPpyRUhfpkBtQna7ofMq1i+zxFAYtI+Di4j/QHq6PE7
DqILf+jFgB0=
=s80o
-----END PGP SIGNATURE-----