getStyle(); if (!$style instanceof \PhpOffice\PhpWord\Style\Paragraph) { return; } $alignments = array( Alignment::ALIGN_LEFT => '\ql', Alignment::ALIGN_RIGHT => '\qr', Alignment::ALIGN_CENTER => '\qc', Alignment::ALIGN_BOTH => '\qj', ); $align = $style->getAlign(); $spaceAfter = $style->getSpaceAfter(); $spaceBefore = $style->getSpaceBefore(); $content = '\pard\nowidctlpar'; if (isset($alignments[$align])) { $content .= $alignments[$align]; } $content .= $this->getValueIf($spaceBefore !== null, '\sb' . $spaceBefore); $content .= $this->getValueIf($spaceAfter !== null, '\sa' . $spaceAfter); return $content; } }