Description
Symfony version(s) affected
6.2
Description
Using box-styles for tables is awesome !
However, if combined with span, rendering is not very pleasant anymore :
- border that are over or under a col-spanned cell draw vertical lines, as if they weren't. See above und under cell "H".
- right border after a col-spanned cell sometimes use the bad border char
** sometimes it's simple instead of double, see right of cells 1.4 / 4.4
** sometimes it's double instead of simple, see right of cell 4.3
I will try the same with the latest Symfony version, (but I doubt it has been done).
BTW, I know this will complicate a lot the style rendering. It requires refactoring to make methods like "getCrossingChars" depend upon the previous and next row we're rendring.
I will try it as an exercise when I'll have some available time.
It will also raise questions, like how to deal with vertical continuity when a col-spanned cell is in the middle of the table, like cell 3.3-4 ? I'll imagine every possible case, and propose an answer for each.
How to reproduce
$table = new Table($output);
$table->setStyle('box-double');
$table->setHeaders(
[
new TableCell(
'H. A totally full spanned long header ',
['colspan' => 4, 'style' => new TableCellStyle(['align' => 'center'])]
)
]
);
$table->addRow([
new TableCell('1-3.1. spanned on 3 rows', ['rowspan' => 3]),
new TableCell('1.2-3. a spanned cell across two cols', ['colspan' => 2]),
'1.4 content'
]);
$table->addRow([
'2.2 content',
'2.3. content',
'2.4 content',
]);
$table->addRow([
'3.2 content',
new TableCell('3.3-4 content', ['colspan' => 2]),
]);
$table->addRow([
new TableCell('4.1-2. a spanned cell across two cols', ['colspan' => 2]),
'4.3. content',
'4.4. content',
]);
$table->setFooterTitle('footer');
$table->render();
Possible Solution
None so far. I just opened the TableStyle class, I'll have to understand how it handles the borders.
Additional Context
No response