Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

marginTop and marginLeft of addImage is not working #893

Open
bryanrsebastian opened this issue Sep 16, 2016 · 6 comments
Open

marginTop and marginLeft of addImage is not working #893

bryanrsebastian opened this issue Sep 16, 2016 · 6 comments

Comments

@bryanrsebastian
Copy link

bryanrsebastian commented Sep 16, 2016

I spend 1 week of thinking and searching why marginTop and marginLeft is not working on addImage?
I use 0.13.* version of PHPWord.
Please help me.
Thank you very much.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@bryanrsebastian
Copy link
Author

bryanrsebastian commented Sep 16, 2016

this is my code for adding an image.
$section->addImage( 'resources/_mars.jpg', array( 'wrappingStyle' => 'behind', 'positioning' =>'relative', 'width' => 100, 'height' => 100, 'marginTop' => 20, 'marginLeft' => 20, 'align' => 'left' ) );

@eleven26
Copy link

I also spend several days using phpword, and I found that cellMargin doesn't work in table.

@diogo-garcia
Copy link

Same problem here, I'm using the lastest source...

@omarpiani
Copy link
Contributor

here the same...

@FBnil
Copy link

FBnil commented Oct 10, 2017

./src/PhpWord/SimpleType/Jc.php says you should use 'align' =>Jc::START instead of 'left'
Also look in ./src/PhpWord/Style/Image.php for positioning commands.

For the cellMargin, can you make a small test example?

@sensoeurn
Copy link

This work for me:

    $section->addImage(
        file_get_contents(public_path('img/logo.png')),
        array(
            'width'  => 50,
            'height' => 50,
            'marginLeft' => \PhpOffice\PhpWord\Shared\Drawing::centimetersToPixels(2.5),
            'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE,
            'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE,
        )
    );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants