You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to add a image in header,and make it behind text, so I set
$img_style = [
'positioning' => 'absolute',
'marginLeft' => 45,
'marginTop' => -44,
'width' => 100,
'height' => 94,
'wrappingStyle' => 'behind',
'posHorizontal' => 'absolute',
'posHorizontalRel' => 'page',
'posVertical' => 'absolute',
'posVerticalRel' => 'line',
];
but I find that the image always front the text.
At last, I modify the file "PhpOffice\PhpWord\Writer\Word2007\Style\Frame.php"
Line 44:
$zIndices = array(FrameStyle::WRAP_INFRONT => PHP_INT_MAX, FrameStyle::WRAP_BEHIND => -PHP_INT_MAX);
new code:
$maxIndex = PHP_INT_MAX > 251659264 ? 251659264 : PHP_INT_MAX;
$zIndices = array(FrameStyle::WRAP_INFRONT => $maxIndex, FrameStyle::WRAP_BEHIND => -$maxIndex);
The result was what I wanted. Wish it could help people with the same confusion.
By the way, constant values in "PhpOffice\PhpWord\Style\Image.php" misguide me.
the style "posHorizontal" and "posVertical" both can set 'absolute'.
@yule2001@praveshpushp do you still have this issue with version 0.14?
This should have been fixed by #1178
Feel free to reopen this issue if not fixed.
I want to add a image in header,and make it behind text, so I set
$img_style = [
'positioning' => 'absolute',
'marginLeft' => 45,
'marginTop' => -44,
'width' => 100,
'height' => 94,
'wrappingStyle' => 'behind',
'posHorizontal' => 'absolute',
'posHorizontalRel' => 'page',
'posVertical' => 'absolute',
'posVerticalRel' => 'line',
];
but I find that the image always front the text.
At last, I modify the file "PhpOffice\PhpWord\Writer\Word2007\Style\Frame.php"
Line 44:
$zIndices = array(FrameStyle::WRAP_INFRONT => PHP_INT_MAX, FrameStyle::WRAP_BEHIND => -PHP_INT_MAX);
new code:
$maxIndex = PHP_INT_MAX > 251659264 ? 251659264 : PHP_INT_MAX;
$zIndices = array(FrameStyle::WRAP_INFRONT => $maxIndex, FrameStyle::WRAP_BEHIND => -$maxIndex);
The result was what I wanted. Wish it could help people with the same confusion.
By the way, constant values in "PhpOffice\PhpWord\Style\Image.php" misguide me.
the style "posHorizontal" and "posVertical" both can set 'absolute'.
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: