Forum Bugs

tablecells get too big

jeric
Hi,

When testing prince xml in our reporting application we came across the following thing:
When a fixed width for a table cell is specified (in this case 30px) and the text in the cell would exceed the specified width, the text is wrapped onto multiple lines. If that happens, the width of the cell becomes bigger than the minimum required width for the text (yeah it sounds complicated but the images will explain it)

If you look at the following image:



Here the second and fourth column are bigger than the minimum width required for the text in them.

The next image shows how mozilla/firefox renders the same table:



For us it is really a problem since we can have tables with a lot of cells and if the html looks ok, the pdf should also, but in these cases the table would run-off the page and the rightmost part of the table is unreadable.
xuehong
Hi,

I assume that you are using "auto table layout".

1. Why the second and fourth columns are bigger than their minimum width?

Based on the CSS21 specification:
1) When table width is "auto": If the sum of column maximum is less or equal to the container width then column maximum will be used as the final table width ; otherwise, the greater of the container width and the sum of column minimum will be used as the final table width.
2) When table width has a specified width (not "auto"): The greater of the specified table width and the sum of column minimum will be used as the final table width.

In your example, I can't tell if the table has a specified width or "auto" width, but I guess the sum of column maximum is bigger than the container width (or specified table width) and the sum of column minimum is smaller than the container width (or specified table width), so the container width (or specified table width) will be used as the final table width. Prince assigns each column it's minimum width first then distributes the extra space to columns that have not reached their maximum. That is why the second and fourth columns are little bit bigger than their minimum (in fact, so is the first column).

I have made a test case similar to yours (set table width to "auto" or "100%; set first col width to auto and the rest to 30px). Opera renders it similar to what Prince does, but Firefox renders it differently. We need to investigate the issue further to check which one is more correct and see if we need to modify the current space distribution policy.

2. table would run-off the page and the rightmost part of the table is unreadable?

The image you gave us doesn't show the problem.
The table will not run off the page, unless the specified table width is bigger than the page, or the sum of column minimum is bigger than the page.

Xuehong