【发布时间】:2016-05-10 03:28:24
【问题描述】:
我正在尝试将一些表格添加到文档中,经过大量工作后,它显示正确。使用 PHPWord 生成。问题是我在表格、行或单元格样式中添加的任何内容都不会修改表格。
我已经尝试过:$table->addRow(15)、$table->addRow(array('height'=>15)),如下面的代码所示。
此外,没有关于如何添加包含两行文本的单元格的文档,因为在“签名”下方我必须添加“姓名”。
//TABLE1
$table = $section->addTable(array('width'=>100, 'borderSize'=> 1, 'borderColor'=>'000000'));
$table->addRow(15,array('height'=>15));
$table->addCell(array('width'=>150))->addText('COMPANY', $smallBoldFont);
$table->addRow();
$table->addCell()->addText('');
$table->addRow();
$table->addCell()->addText('');
//TABLE1
$section->addTextBreak(2);
//TABLE2
$table2 = $section->addTable(array('borderSize'=> 1, 'borderColor'=>'000000'));
$table2->addRow(100,array('height'=>80));
$table2->addCell(150,array('width'=>800))->addText('Recibed', $smallFont8);
$table2->addRow();
$table2->addCell()->addText('Time:', $smallFont8);
$table2->addCell()->addText('Sign:', $smallFont8);
//TABLE2
PHPWord 忽略我对表格的格式样式有什么原因吗?还有其他更好的方法吗?
期望的输出:
实际输出:
【问题讨论】: