Hello,
You need to use a custom paragraph style or a custom style list imported from an existing DOCX , use an existing style in a template or create a custom paragraph style using createParagraphStyle.
This is a simple sample of a custom paragraph style created dynamically to set custom spacings:
// style options
$style = array(
'lineSpacing' => 480,
'spacingTop' => 360,
'spacingBottom' => 360,
);
$docx->createParagraphStyle('myStyle', $style);
$item1 = new WordFragment($docx);
$item1->addText('Line 1', array('pStyle' => 'myStyle'));
$item2 = new WordFragment($docx);
$item2->addText('Line 2', array('pStyle' => 'myStyle'));
$item3 = new WordFragment($docx);
$item3->addText('Line 3', array('pStyle' => 'myStyle'));
$itemList = array(
$item1,
$item2,
$item3,
);
$docx->addList($itemList, 1, array('useWordFragmentStyles' => true));
Regards.