Forum


Replies: 3   Views: 3508
Addshape adds extra row after
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by kobbe  · 18-08-2016 - 08:22

$options = [
        'from' => '0,0',
        'to' => '640,0',
        'strokecolor' => '#000000',
        'strokeweight' => '1',
        'position' => 'relative',
];
$docx->addShape('line', $options);
$docx->addText('test test test');

When I use this the result becomes:

-------

[enter]

test test test

 

 

Is there a way to remove this extra row? I need text on the very next row without the space inbetween.

 

Also the from value... I do not undestand what convertion I need to use if i want the line to stop at 190mm (20 mm from right side on A4 paper).

 

Thanks!

 

(Using 6.0 Corporate)

Posted by admin  · 18-08-2016 - 13:54

Hello,

All shapes are wrapped by a paragraph tag that adds default Word spacing (you can set a custom spacing using a template). We recommend you to check the sample available on:
http://www.phpdocx.com/api-documentation/word-content/add-shape-Word-document-with-PHP

That adds a shape with its position changed using the option marginTop. You can use this option to accomplish what you need.

About from option, it sets the x and y coordinates. You can also use the width option to set the size of the shape.

Regards.

Posted by kobbe  · 18-08-2016 - 14:38

Thanks for answer.

In documentation on that page it say margin-top, but in example marginTop is used. What is the correct way?

 

You missunderstood my question about "from" x/y cords. I wonder what unit it is.... px? pt? twip? mm?

 

Thanks :)