Skip to content
Advertisement

How to stretch the footer to the full width of the page using phpword?

I use PHPWord to generate a document. How can I remove the indent on the left side for the footer, so that it occupies the entire width?

For header, I use:

$header = $section->addHeader();
        $header->addImage('images/header.png',
            array(
                'width'=>600,
                'height'=>72,
                'marginLeft' => -75,
                'positioning'=>'absolute',
                'wrappingStyle'=> 'behind',
                'posHorizontal' => 'absolute',
                'posVertical' => 'absolute'
            ));

but for footer it doesn’t work.

$footer = $section->addFooter();
        $footer->addImage('images/footer.png',
            array(
                'width'=>600,
                'height'=>72,
                'marginLeft' => -75,
                'positioning'=>'absolute',
                'posHorizontal' => 'absolute',
                'posVertical' => 'absolute',
            ));

And the second question, is it possible to put text on top of the image in the footer using phpword?

Advertisement

Answer

I solved my question. I used for footer:

$footer->addImage('images/footer.png',
            array(
                'width'=>600,
                'height'=>72,
                'positioning' => PhpOfficePhpWordStyleImage::POSITION_ABSOLUTE,
                'posHorizontal' => PhpOfficePhpWordStyleImage::POSITION_ABSOLUTE,
                'posVertical' => PhpOfficePhpWordStyleImage::POSITION_ABSOLUTE,
                'marginLeft' => -75,
                'marginTop'=>-50,
                'wrappingStyle'=> 'behind'
            ));
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement