PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, November 10, 2022

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

 November 10, 2022     doc, php, phpword     No comments   

Issue

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?


Solution

I solved my question. I used for footer:

$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'
            ));


Answered By - Yuliia
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing