Page breaks inside tables with spanning cells

2,140 views
Skip to first unread message

Ioannis Kalavros

unread,
Oct 7, 2009, 9:09:18 AM10/7/09
to dom...@googlegroups.com
Hello,

I have some long tables which have cells spanning on multiple rows. the problem is that when the page break happens between those rows, the output isn't displayed correctly.

I'll try to describe it using an example. Let's suppose that our code is the following:

<table>
<tr>
<td rowspan=2>cell_A_0</td>
<td>cell_A_1</td>
<td>cell_A_2</td>
</tr>
<!-- breakpoint1 -->
<tr>
<td>cell_A_3</td>
<td>cell_A_4</td>
</tr>
<!-- breakpoint2 -->
<tr>
<td rowspan=2>cell_B_0</td>
<td>cell_B_1</td>
<td>cell_B_2</td>
</tr>
<tr>
<td>cell_B_3</td>
<td>cell_B_4</td>
</tr>
</table>



If the page break happens at the "breakpoint2", everything is ok and the output is as expected:

[cell_A_0][cell_A_1][cell_A_2]
[cell_A_0][cell_A_3][cell_A_4]
-----page break-----
[cell_B_0][cell_B_1][cell_B_2]
[cell_B_0][cell_B_3][cell_B_4]


But if the it braks at the "breakpoint1" the output is displayed like this:

[cell_A_0][cell_A_1][cell_A_2]
-----page break-----
[cell_A_3][cell_A_4]
[cell_B_0][cell_B_1][cell_B_2]
[cell_B_0][cell_B_3][cell_B_4]


Is there any way to avoid these breaks?
Using the page-break-before or page-break-after html tags isn't a solution because the tables are bigger than one page.

Any suggestions are welcome!

Thanks,
   Ioannis

ikawka

unread,
Oct 7, 2009, 7:57:12 PM10/7/09
to dompdf
I encountered something like this, all i did was put width attribute
on each cell and also to the table tag

On Oct 7, 9:09 pm, Ioannis Kalavros <ioannis.kalav...@gmail.com>
wrote:

psychoactive

unread,
Oct 7, 2009, 8:41:51 PM10/7/09
to dompdf
correct, just put the cell width in every cell, or at least on one
cell per page.

Ioannis Kalavros

unread,
Oct 8, 2009, 3:01:52 AM10/8/09
to dom...@googlegroups.com
Hello again,

I tried it but it doesn't seem to solve the problem.

I had the cell widths defined in the CSS file, and I also tried to write them on each TD tag (ant in the TABLE tag) but the problem remains.
Take a look at this screenshot to see what I mean: http://img24.imageshack.us/img24/8839/pdftable.png

BrianS

unread,
Oct 8, 2009, 2:49:14 PM10/8/09
to dompdf
On Oct 7, 9:09 am, Ioannis Kalavros <ioannis.kalav...@gmail.com>
wrote:
Unfortunately DOMPDF has problems maintaining table information across
pages. The other suggestions are correct for maintaining cell widths
across pages, but it won't help when a cell that spans multiple rows
is broken across pages. DOMPDF will lose all information about this
cell when it moves to the next page. Unfortunately, there's not a easy
fix for this at present.

While some table problems have been addressed for the next release,
there are still a few major outstanding issues (such as this one) that
will not be fixed. I would hope to do some work on tables in the
following release.
-b

Ioannis Kalavros

unread,
Oct 9, 2009, 2:57:04 AM10/9/09
to dom...@googlegroups.com

Thanks for the reply Brian!

I'll pout some empty cells so that the table will maintain the correct form.

Dompdf is a great software, keep on the good work you are doing! :)
Reply all
Reply to author
Forward
0 new messages