Closed
Description
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection(
[
'orientation' => 'landscape',
'marginTop' => 600,
'marginLeft' => 600,
'marginRight' => 600,
'marginBottom' => 600,
]
);
$tableStyle = [
'width' => 100,
'borderSize' => 6,
'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER,
];
$phpWord->addTableStyle('myTable', $tableStyle);
$table = $section->addTable('myTable');
$row = $table->addRow();
$row->addCell(4200, ['valign' => 'center', 'vMerge' => 'restart'])
->addText('A', null, ['align' => 'center']);
$row->addCell(null, ['textDirection' => Cell::TEXT_DIR_BTLR, 'gridSpan' => 2, 'vMerge' => 'restart',])
->addText('B', null, ['align' => 'center']);
$row->addCell(null, ['textDirection' => Cell::TEXT_DIR_BTLR, 'gridSpan' => 4])
->addText('1', null, ['align' => 'center']);
$row = $table->addRow();
$row->addCell(null, ['vMerge' => 'continue']);
$row->addCell(null, ['vMerge' => 'continue']);
$row->addCell(null, ['vMerge' => 'continue']);
$row->addCell(null, ['gridSpan' => 2])->addText('2');
$row->addCell(null, ['gridSpan' => 2]);
$row = $table->addRow();
$row->addCell(null, ['vMerge' => 'continue']);
$row->addCell()->addText('C');
$row->addCell()->addText('D');
$row->addCell()->addText('3');
$row->addCell();
$row->addCell();
$row->addCell();
To fix: Missing gridspan
in the second block:
<w:tc>
<w:tcPr>
<w:tcW w:w="0" w:type="dxa"/>
<!--here need gridSpan-->
<w:vMerge/>
</w:tcPr>
<w:p w:rsidR="00907392" w:rsidRDefault="00907392"/>
</w:tc>