Skip to content

Symfony\Component\Console\Helper\Table counts wrong column width when use colspan. #60043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vladimir-vv opened this issue Mar 26, 2025 · 0 comments

Comments

@vladimir-vv
Copy link

Symfony version(s) affected

6.4

Description

When use colspan in headers and setColumnMaxWidth on first of spanned column the header will be wrapped.

How to reproduce

<?php
// ...
$table = new Table($output);
    $table
        ->setHeaders([new TableCell('Column 1 spanned', ['colspan' => 2]), 'Column 2', 'Column 3'])
        ->setColumnMaxWidth(0, 1)
        ->setRows([
            ['', '99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'],
            ['', '9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'],
            ['*', '960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'],
        ]);
    $table->setHeaderTitle('Testing');
    $table->render();

Possible Solution

I will provide the PR with my suggestions.

Additional Context

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants