-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
My daytime job took so much time last two weeks, that I was not able to contribute. However, it has become quieter and I resynced my development tree.
All of a sudden some test code did not work any longer. For positioning an image and two textboxes, I used the following style:
$textbox = $section->addTextBox($style = array(
'width' => \PhpOffice\PhpWord\Shared\Drawing::centimetersToPixels(4.5),
'height' => \PhpOffice\PhpWord\Shared\Drawing::centimetersToPixels(17.3),
'positioning' => 'absolute',
'posHorizontalRel' => 'page',
'posVerticalRel' => 'page',
'marginLeft' => \PhpOffice\PhpWord\Shared\Drawing::centimetersToPixels(15.3),
'marginTop' => \PhpOffice\PhpWord\Shared\Drawing::centimetersToPixels(9.9),
'stroke' => 0,
'innerMargin' => 0,
'borderSize' => 1,
'borderColor' => '',
'wrappingStyle' => \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_SQUARE
));
Using this code, no longer positions the image or textbox correctly. The position was simply marginLeft=0 and marginTop=0. When I change the relevant part into:
'marginLeft' => 578,
'marginTop' => 374,
The image and textbox are correctly positioned. Note, that 'width' and 'height' do not need to be changed.
I cannot find why this behaviour is all of a sudden present. It might be a result of static vs dynamic functions, but my knowledge in this respect is very limited.