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

Fails to add horizontal line to docx/odt document #568

Open
samuelsh opened this issue Jul 6, 2015 · 1 comment
Open

Fails to add horizontal line to docx/odt document #568

samuelsh opened this issue Jul 6, 2015 · 1 comment

Comments

@samuelsh
Copy link

samuelsh commented Jul 6, 2015

Hello friends,

I'd started to use PHPWord to generate DOCX/ODT from my PHP application.

While it mostly works "out of the box" for me, there is an issue, while trying to add "Horizontal line" to my generated document.

This code just adds nothing, and I can't figure out what's the problem:

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addLine(array('dash' => 'dash', 'width' => 100, 'height' => 2, 'weight' => 10));

$phpWord->save(wp_upload_dir()['basedir'].'/test.odt', 'ODText'); // it won't display horizontal line in DOCX either

PHP 5.4.41-0+deb7u1 (cli) (built: May 28 2015 18:22:26)
Debian GNU/Linux 7.8 (wheezy)


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

@samp1703
Copy link

samp1703 commented May 19, 2018

$section = $phpWord->addSection();
Try this,
$section->addLine(
array(
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(12),
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0),
'positioning' => 'absolute','weight' => 2
)
);

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

No branches or pull requests

3 participants