You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using 1.20 and I've been facing this issue as well. After much trial and error I found that I needed to add "spaceAfter" twice on the text in the cell.
$headerTextStyle = array(
'bold' => true,
'spaceAfter' => 0
);
$textStyle = array(
'spaceAfter' => 0
);
$tableStyle = array(
'width' => 100 * 50, // Word 2007 table width, in percentages, is measured in 50ths of a percent'unit' => 'pct',
'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER,
'cellMargin' => 100,
);
$table = new \PhpOffice\PhpWord\Element\Table($tableStyle);
$row = $table->addRow();
$row->addCell()->addText('Vertically centered heading', $headerTextStyle, $textStyle);
$row = $table->addRow();
$row->addCell()->addText('Vertically centered', $textStyle, textStyle);
Hi,
I have to use phpword 0.18.3 and when creating the tables I encounter the problem shown in the image.
$cell = $row->addCell(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(9), ['valign' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
The contents of the cells are not vertically centered and I cannot do this from Office or another word editor.
Does anyone have a solution?
Thanks
The text was updated successfully, but these errors were encountered: