element instanceof \PhpOffice\PhpWord\Element\Text) { return; } // Paragraph style $paragraphStyle = $this->element->getParagraphStyle(); $pStyleIsObject = ($paragraphStyle instanceof Paragraph); if ($pStyleIsObject) { $styleWriter = new ParagraphStyleWriter($paragraphStyle); $paragraphStyle = $styleWriter->write(); } $hasParagraphStyle = $paragraphStyle && !$this->withoutP; // Font style $fontStyle = $this->element->getFontStyle(); $fontStyleIsObject = ($fontStyle instanceof Font); if ($fontStyleIsObject) { $styleWriter = new FontStyleWriter($fontStyle); $fontStyle = $styleWriter->write(); } $openingTags = ''; $endingTags = ''; if ($hasParagraphStyle) { $attribute = $pStyleIsObject ? 'style' : 'class'; $openingTags = "
"; $endingTags = '
' . PHP_EOL; } if ($fontStyle) { $attribute = $fontStyleIsObject ? 'style' : 'class'; $openingTags = $openingTags . ""; $endingTags = '' . $endingTags; } $html = $openingTags . htmlspecialchars($this->element->getText()) . $endingTags; return $html; } }