PHPWord - set line spacing to "single"

user2345998 picture user2345998 · Jul 31, 2015 · Viewed 7.1k times · Source

I have to generate some word docs with PHP and need to change the line spacing and line height.

Setting the line height is simple, but I have no idea how I change change the line spacing from "multiple" to "single". (I hope I use the right terms here because I got only a german word version...)

I've added a picture to make clear which option I mean...

enter image description here

Answer

ejuhjav picture ejuhjav · Aug 3, 2015

You can set the spacing styles (including line spacing) with the paragraph style - you just need to define the value in twips... for example:

$paragraphOptions = array('space' => array('line' => 1000));

This style option seems to be missing from the referenced styles documentation but it is documented in the source code that line spacing is modifiable Paragraph style src