无法让页眉文本与 phpWord 文档中的页脚顶部对齐

问题描述 投票:0回答:2

我的标题左侧有徽标,右侧有文字。它几乎是完美的,但我无法让文本出现在页面的最顶部;它显示在 中间 左侧的徽标。

我已经尝试过所有的文本参数——空格、缩进、之前和之后——但无济于事。有什么想法吗?

我的代码是:

$section = $phpWord->addSection();   

$header = $section->addHeader();
$header ->addImage('logo.png',
        array(
            'width' => 200,
            'height' => 80,
          'wrappingStyle' => 'square',
    'positioning' => 'absolute',
    'posHorizontalRel' => 'margin',
    'posVerticalRel' => 'line',
        )
    );

$header->addText(
    'Company Name, Address blah blah
Blah blah blah blah blah blah blah',
    array('bold' => true),
    array(
        'space' => array('before' => 2, 'after' => 500), 
        'indentation' => array('left' => 4500, 'right' => 10)
    )
  );
php phpword
2个回答
1
投票

仅在标题内使用表格怎么样?使用类似的东西(ofc 将单元格大小调整为与您的徽标大小相匹配):

$section = $phpWord->addSection();   

$header = $section->addHeader();
$table = $header->addTable();
$table->addRow();
$table->addCell(4500)->addImage('logo.png',
        array(
            'width' => 200,
            'height' => 80,
        )
    );

$table->addCell(4500)->addText(
    'Company Name, Address blah blah Blah blah blah blah blah blah blah',
    array('bold' => true)
  );

0
投票

我不需要 php 我需要 html css js

© www.soinside.com 2019 - 2024. All rights reserved.