【发布时间】:2015-06-26 12:44:11
【问题描述】:
我正在使用 phpWord,对页眉/页脚内容进行更改让我非常难过。我正在尝试将标题内容安排在表格中。该表是通过我编写的代码创建的。但是我尝试应用于放在表头中的表格的样式没有生效。
以下是我可能会犯错误的代码的一部分。
$phpWordObj = new PhpWord();
$section = $phpWordObj->addSection();
$styleTable = array('borderSize' => 18, 'borderColor' => '006699');
$phpWordObj->addTableStyle('My Custom Style', $styleTable);
//ADD HEADER TO DOCUMENT
$header = $section->addHeader();
$header->firstPage();
$table = $header->addTable();
$table->addRow();
//logo
$table->addCell(2000)->addImage(
'../vendor/phpoffice/phpword/samples/resources/PhpWord.png',
array('width' => 80, 'height' => 80, 'align' => 'left')
); //logo
$cell = $table->addCell(7000);
$textrun = $cell->addTextRun();
$textrun->addText(htmlspecialchars('Custom Name goes here...'));
$headerGen = $section->addHeader();
$tableGenHeader = $headerGen->addTable();
$tableGenHeader->addRow();
//logo
$tableGenHeader->addCell(2000)->addImage(
'../vendor/phpoffice/phpword/samples/resources/PhpWord.png',
array('width' => 80, 'height' => 80, 'align' => 'left')
);
$cellGenHeader = $tableGenHeader->addCell(7000);
$textrunGenHeader = $cellGenHeader->addTextRun();
$textrunGenHeader->addText(htmlspecialchars('Custom Name goes here...'));
我想要的只是出现边框,以便标题内容可以相互区分。
谢谢!
【问题讨论】: