Take the 2-minute tour ×

Here is my problem, I have a table like this

This is a column header (A)  | Another Column header (B) | Header (C) | Another column Header (D)
Value A                      | Value B                   |  Value C   | Value D

The thing is, the values in columns A and C, say can be very long whereas the values in B and D can be very short. I don't mind if the headers or the values wrap - so ideally I would like a typical table to look like the following

This is a column header (A)             | Another       | Header (C)                        | Another 
                                        | Column        |                                   | column 
                                        | header (B)    |                                   | Header (D)
Value is very long and verbose, bla bla | Value B       | Value C - this to is quite long   | Value D
bla bla bla - see it wrapped            |               |                                   |

Essentially, I would like the column headers to wrap in preference to the values in the table data cells. I cannot simply apply the wrap-option="no-wrap" attribute to the table cells - as the page is not wide enough to accommodate all the long text.

I have tried specifying proportional-column-width attribute to the columns - but this is not ideal as I don't know which columns will contain the longest text in all circumstances.

The best solution that I have come up with at the moment, is to explicitly put line breaks in the column header text but this has the unwanted side effect that it seems to increase the column width a fair amount. See http://snipplr.com/view/37957/xslfo-to-make-a-table/ for an example. This produces this output http://imagebin.org/106996 . Note how columns3, 4, 5, 6 and 7 seem to have rather generous padding, which means that columns1 and 2 are narrower than they could be.

Any help would be greatly appreciated.

PS - I am using the Ibex rendering engine http://www.xmlpdf.com

share|improve this question
add comment

1 Answer

I'm not sure which rendering engine you're using. But if it supports table-layout="auto" (which most commersial engines does) this might give you a better result than the result you get now. Without any explict line breaks.

See the XSL specification for table-layout property and the corresponding CSS2 specification.

share|improve this answer
I am using Ibex xmlpdf.com. Its default is to use table-layout="auto" but having a look at the docs, I thinkI might try table-lyout="fixed" and see if I can get better results. –  Chris F Jul 28 '10 at 14:01
add comment

Your Answer


