【发布时间】:2015-04-30 11:15:48
【问题描述】:
我正在尝试使用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);
这就是我得到的:
----------------------
| | |
|---------------------------------
| | | | |
----------------------------------
【问题讨论】:
-
找到了,我必须添加 array('gridSpan' => 3) ($table->addCell(15000, array('gridSpan' => 3))->addText(htmlspecialchars(' text'), $fontTitle);)
-
写一个答案并将其标记为已解决。
标签: php codeigniter phpword