-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Cannot set table width through a style defined by addTableStyle() #629
Comments
I can confirm this with the last version of PHPWord. |
Also confirmed. |
Yes, this is the case. I'm not sure why you also need 100 * 50 for the width. It's possible that if the width is just set to a really large number then it just takes up 100%. Edit: I just saw the comment: |
The table style class works well for setting items like so: // Create a new table style
$table_style = new \PhpOffice\PhpWord\Style\Table;
$table_style->setBorderColor('cccccc');
$table_style->setBorderSize(1);
$table_style->setUnit(\PhpOffice\PhpWord\Style\Table::WIDTH_PERCENT);
$table_style->setWidth(100 * 50);
// Add a section to the document.
$section = $this->phpword->addSection();
// Set up our table.
$table = $section->addTable($table_style); There's a setStyleName on a parent class which just sets $this->styleName, and I'm not sure if there's a way to subsequently refer to the style by name. |
Just hit this bug as well. |
Does anyone know the status of this bug? I just installed phpoffice/phpword a couple days ago, and while developing my code, I noticed this same thing is happening. Very Confusing. Thanks @ant-s for the alternative. |
me too……on "phpoffice/phpword": "^0.16.0" (composer.json) |
Same issue, trying to use a style defined in my document template example "TBL1" but also specify the table width which must be set per table. Seems it is not part of the style in MsWord. |
According to documentation this should write a 100% width table but width is ignored:
Only the following writes a 100% width table as expected:
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: