Open hari-web opened 9 years ago
I just found out that you have to set style "layout" fixed on your table like below
$fancyTableStyle = [
'borderSize' => 6,
'borderColor' => '000000',
'cellMargin' => 80,
'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER,
'layout' => \PhpOffice\PhpWord\Style\Table::LAYOUT_FIXED,
];
$table = $section->addTable($fancyTableStyle);
and then the long word will wrap itself inside the cell.
If you preset a table style on your phpword object, the layout style won't work.
$fancyTableStyleName = 'Fancy Table';
$fancyTableStyle = [
'borderSize' => 6,
'borderColor' => '000000',
'cellMargin' => 80,
'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER,
'layout' => \PhpOffice\PhpWord\Style\Table::LAYOUT_FIXED,
];
//table will not be fixed
$table = $section->addTable($fancyTableStyleName);
In ms word you also need to set the autofit option directly on each table, maybe that's why.
I think this issue can be closed?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue for you, please try to help by debugging it further and sharing your results. Thank you for your contributions.
Hi,
Im using phpword version 0.12.0. I have a problem on managing large contents writing inside cell. Even the cell have some fixed width , if the content too large (case when there is no space between characters), cell layouts becomes broken. (please see the image) ![enter image description here][1] Any one know how to solve this situation. Thanks in advance