0

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

Thanks for help

Samuel
  • 3,631
  • 5
  • 37
  • 71
  • Which version of phpword are you using? The above code works fine for docx in 0.12.0. Not visible in odt for me neither... – ejuhjav Jul 06 '15 at 12:10
  • @ejuhjav I'm using 0.12.0 form GitHub cloned in June 26 – Samuel Jul 06 '15 at 12:16
  • $phpWord->save(wp_upload_dir()['basedir'].'/test.docx', 'Word2007'); is not working for you? – ejuhjav Jul 06 '15 at 12:24
  • @ejuhjav It does saving the file but with no sign of horizontal line :) – Samuel Jul 06 '15 at 12:26
  • 1
    duh, that works for me... have you tested whether the addLine examples from 'samples/Sample_29_Line.php' produce something or are the lines missing from those as well? If those fail to produce any lines maybe you could try opening the files with some other editor (in case you haven't tried that option already). Otherwise I'm a bit out of suggestions – ejuhjav Jul 06 '15 at 13:04
  • @ejuhjav I'd actually tried samples as well but with the same result. Maybe OS/word processor issue? I'm running under Debian 7.8 with LibreOffice. Where do you opened your DOCX? – Samuel Jul 06 '15 at 13:08
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/82502/discussion-between-ejuhjav-and-samuel). – ejuhjav Jul 06 '15 at 13:35

0 Answers0