p->xpath('w:r'); foreach ($runs as $run) { $tr = new TextRun($this->docx, $run, "\n"); // use real line breaks $this->text .= $tr->__toString(); } } /** @inheritdoc */ public function __toString(): string { return '' . "\n" . $this->text . "\n" . ''; } }