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', ); $alignment = $style->getAlignment(); $spaceAfter = $style->getSpaceAfter(); $spaceBefore = $style->getSpaceBefore(); $content = ''; if ($this->nestedLevel == 0) { $content .= '\pard\nowidctlpar '; } if (!is_null($alignment) && isset($alignments[$alignment->getValue()])) { $content .= $alignments[$alignment->getValue()]; } $content .= $this->getValueIf($spaceBefore !== null, '\sb' . $spaceBefore); $content .= $this->getValueIf($spaceAfter !== null, '\sa' . $spaceAfter); return $content; } /** * Set nested level. * * @param int $value * @return void */ public function setNestedLevel($value) { $this->nestedLevel = $value; } }