【发布时间】:2019-07-19 08:08:40
【问题描述】:
我正在创建一个将使用 LibreOffice 打开的 docx 文件,但在同一页面上显示页眉和页脚时遇到了一些问题
当我同时添加页眉和页脚进行显示时,第一页上只显示一个,然后我得到一个空页面,然后我的页面上下文在第二页上同时显示了页眉和页脚。如果我将页脚放在页眉之前,它将是每页上的页脚,如果我将页眉放在页脚之前,则相同
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->createSection();
$footer = $section->createFooter(array('align'=>'center'));
$footer->addPreserveText('POSTAL ADRESS some text ');
$footer->addPreserveText('STANDARD - tel: - fax: ');
$footer->addPreserveText("Page {PAGE} of {NUMPAGES}.");
$section = $phpWord->createSection();
$header = $section->createHeader();
$header->addImage(
'image.png',
array(
'width' => 150,
'height'=> 75,
'marginTop'=>500,
'marginLeft'=>400000,
'align'=>'center',
)
);
我希望有一个同时显示页眉和页脚的页面。
【问题讨论】:
标签: phpword