我正在尝试用PHPWord创建一个表格,表格应该是这样的:有些行包含2个单元格,有些行包含4个单元格
------------------------
| | |
|-----------------------
| | |
------------------------
| | | | |
|-----------------------这是我的代码的一部分
$table->addRow(200);
$table->addCell(2000, $styleTitleCell)->addText(htmlspecialchars('text'), $fontTitle);
$table->addCell(15000, $styleCell)->addText(htmlspecialchars('textVULN'), $fontTitle);
$table->addRow(600);
$table->addCell(2000, $styleTitleCell)->addText(htmlspecialchars('Référence'), $fontTitle);
$table->addCell(15000, $styleCell)->addText(htmlspecialchars(' text'), $fontStyle);
$table->addRow(600);
$table->addCell(2000, $styleTitleCell)->addText(htmlspecialchars('text'), $fontTitle);
$table->addCell(15000, $styleCell)->addText(htmlspecialchars('constats ici'), $fontStyle);
$table->addRow(600);
$table->addCell(2000, $styleTitleCell)->addText(htmlspecialchars('text'), $fontTitle);
$table->addCell(15000, $styleCell)->addText(htmlspecialchars('text'), $fontStyle);
//elements impactés
$table->addRow(600);
$table->addCell(2000, $styleTitleCell)->addText(htmlspecialchars('Eléments impactés'), $fontTitle);
$table->addCell(15000, $styleCell)->addText(htmlspecialchars('Les elements ici'), $fontStyle);
$table->addRow(600);
$table->addCell(2000, $styleTitleCell)->addText(htmlspecialchars('text'), $fontTitle);
$table->addCell(15000, $styleCell)->addText(htmlspecialchars('text'), $fontStyle);
$table->addRow(600);
$table->addCell(2000, $styleTitleCell)->addText(htmlspecialchars('text'), $fontTitle);
$table->addCell(2000, $styleCell)->addText(htmlspecialchars('text'), $fontStyle);
$table->addCell(2000, $styleTitleCell)->addText(htmlspecialchars('text'), $fontTitle);
$table->addCell(2000, $styleCell)->addText(htmlspecialchars('text'), $fontStyle);这就是我所得到的:
----------------------
| | |
|---------------------------------
| | | | |
----------------------------------发布于 2015-05-04 20:05:05
找到它,我必须添加数组(‘gridSpan’=> 3) ($table->addCell(15000,array('gridSpan‘=> 3))->addText(htmlspecialchars('text'),$fontTitle);)
https://stackoverflow.com/questions/29966278
复制相似问题