如何使用phpword将页脚拉伸到页面的整个宽度?
Posted
技术标签:
【中文标题】如何使用phpword将页脚拉伸到页面的整个宽度?【英文标题】:How to stretch the footer to the full width of the page using phpword? 【发布时间】:2020-01-04 09:38:17 【问题描述】:我使用 phpWord 生成文档。 如何删除页脚左侧的缩进,使其占据整个宽度?
对于标题,我使用:
$header = $section->addHeader();
$header->addImage('images/header.png',
array(
'width'=>600,
'height'=>72,
'marginLeft' => -75,
'positioning'=>'absolute',
'wrappingStyle'=> 'behind',
'posHorizontal' => 'absolute',
'posVertical' => 'absolute'
));
但是对于页脚它不起作用。
$footer = $section->addFooter();
$footer->addImage('images/footer.png',
array(
'width'=>600,
'height'=>72,
'marginLeft' => -75,
'positioning'=>'absolute',
'posHorizontal' => 'absolute',
'posVertical' => 'absolute',
));
第二个问题,是否可以使用 phpword 将文本放在页脚中的图像顶部?
【问题讨论】:
【参考方案1】:我解决了我的问题。 我用于页脚:
$footer->addImage('images/footer.png',
array(
'width'=>600,
'height'=>72,
'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE,
'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE,
'posVertical' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE,
'marginLeft' => -75,
'marginTop'=>-50,
'wrappingStyle'=> 'behind'
));
【讨论】:
以上是关于如何使用phpword将页脚拉伸到页面的整个宽度?的主要内容,如果未能解决你的问题,请参考以下文章