[英]How to make the table in word using PHPWord which includes multiple rowspan and colspan?
示例中有一个与您正在做的非常接近的示例: https : //github.com/PHPOffice/PHPWord/blob/develop/samples/Sample_09_Tables.php
并修改一点来实现你的例子:
$cellRowSpan = array('vMerge' => 'restart');
$cellRowContinue = array('vMerge' => 'continue');
$cellColSpan = array('gridSpan' => 2);
$table->addRow();
$table->addCell(2000, $cellRowSpan)->addText("1");
$table->addCell(2000, $cellRowSpan)->addText("2");
$table->addCell(4000, $cellColSpan)->addText("3");
$table->addCell(2000, $cellRowSpan)->addText("6");
$table->addRow();
$table->addCell(null, $cellRowContinue);
$table->addCell(null, $cellRowContinue);
$table->addCell(2000)->addText("4");
$table->addCell(2000)->addText("5");
$table->addCell(null, $cellRowContinue);
$table->addRow();
$table->addCell(2000);
$table->addCell(2000);
$table->addCell(2000);
$table->addCell(2000);
$table->addCell(2000);
用0.13.0版本进行测试(出于某种原因,libreoffice不喜欢带有vMerge的两个adjecent单元继续定义并且没有按预期显示它们,但是word确实显示了它们如预期的那样)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.