codeigniter phpword表格vmerge和gridspan

lc8prwob  于 5个月前  发布在  PHP
关注(0)|答案(1)|浏览(53)

我尝试创建一个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);


这就是我得到的:

----------------------
|     |              | 
|---------------------------------
|     |              |     |     |
----------------------------------

xe55xuns

xe55xuns1#

找到了,我不得不在单元格样式数组中添加'gridSpan' => 3来合并单元格
$table->addCell(15000,$cellStylingArray)->addText($text,$textStylingArray);

$table->addCell(15000, array('gridSpan' => 3))->addText(htmlspecialchars('text'), $fontTitle);

字符串

相关问题