-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Image wrappingStyle has no effect #489
Comments
I was having the same problem, but I noticed that if I told PHPWord to process \samples\Sample_13_Images.php, image wrapping was working fine in the resultant Word document. After a bit of experimentation I found that you must have 'positioning'=>'relative' in your settings array for the image wrapping to work correctly. |
Ahh! - well found - the moment has passed for me actually as i have been round the houses and back with this since then. I am now generating offline and uploading as there were other problems with my project. Hopefully your investigation will help others though. Cheers. |
I'm running into the same issue now. I have an image that covers the page and want text to be on top. Everything I try the image is always on top. $section->addImage('resources/background.png', ['positioning' => 'relative', 'height' => 524, 'width' => 839, 'wrappingStyle' => 'behind']); |
So I found that in src/PhpWord/Writer/Word2007/Style/Frame.php if I change: |
Wow, im so lucky that I found this issue. Very thanks @jmanring. |
Thanks Jmanring, after many tests the only thing that worked for me is your example, you saved my ass. I discovered that the command that forces the text to be displayed in front of or behind the image is -> Try to implement it inside the class-> PhpWord \ Writer \ Word2007 \ Element \ image.php But I can not understand PHPWord, too much abstraction and inheritance, in theory that command should be incorporated into the function responsible for creating the style of shape. Piece of a real document In the end after many hours I gave up and use your example, so again thank you very much |
Thanks @jmanring |
Hi, I'm still having same issue on setImageValue. There's my code: But image still not going behind text. In PhpOffice\PhpWord\Writer\Word2007\Style the maxZIndex is 2147483647. |
@djandrew98 try changing your code to: Maybe you found this one yourself already but you have relative spelled wrong in your code. |
Why is this still not in documentation?? https://phpword.readthedocs.io/en/latest/styles.html#image-style no positioning mentioned, but it works!! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Hi whatever i put for the wrappingStyle variable in the image style array the image is inline when i open the doc in word. The array is being accessed because other element of the array are being used correctly, but the wrappingStyle is being ignored. After opening the doc, I can right click the image and change the format to 'behind text' or what i want, but I can't control it from the php. Any ideas. Also the marginTop and marginLEft are being ignored, just the width and height are working. Thanks:
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: