Skip to content
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

HTML to DOCX table cells width param doesn't seem to work #1933

Open
ivanstroilov opened this issue Sep 10, 2020 · 3 comments
Open

HTML to DOCX table cells width param doesn't seem to work #1933

ivanstroilov opened this issue Sep 10, 2020 · 3 comments

Comments

@ivanstroilov
Copy link

$phpWord = new \PhpOffice\PhpWord\PhpWord();

$section = $phpWord->addSection();

$html = '<table><tr><td width="10%">test</td><td width="90%">test 2</td></tr></table>';

\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html);

$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('test.docx');

Expected Behavior

Table with two cells containing words "test" and "test 2". Width of the cell with the word "test" should be 10% of the table, and width of the cell with the word "test 2" should be 90% of the table

Current Behavior

Table with two cells containing words "test" and "test 2". Width of both cells is 50%

Similar problem with height - it doesn't seem to work at all.

@devfake
Copy link

devfake commented Dec 21, 2020

This is the issue: #1494

@kristl78
Copy link

Same here. It doesn't matter whether you write it this way
<table><tr><td width="10%">test</td><td width="90%">test 2</td></tr></table>
or that
<table><tr><td style="width: 10%">test</td><td style="width: 90%">test 2</td></tr></table>

A solution would be nice. Thx you guys for the great work!!!
Kristina

@alexfurr
Copy link

Second this - td width of either % or pt does nothing.

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

No branches or pull requests

4 participants