- Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
Milestone
Description
Describe the Bug
A clear and concise description of what the bug is.
Steps to Reproduce
Please provide a code sample that reproduces the issue.
$phpWord = IOFactory::load($wordFile);
$wordText = '';
foreach ($phpWord->getSections() as $section) { $elements = $section->getElements(); $numElements = count($elements); foreach ($elements as $key => $element) { if ($element instanceof \PhpOffice\PhpWord\Element\TextRun) { foreach ($element->getElements() as $textElement) { if ($textElement instanceof \PhpOffice\PhpWord\Element\Text) { $wordText .= $textElement->getText(); } } } elseif ($element instanceof \PhpOffice\PhpWord\Element\Text) { $wordText .= $element->getText(); } // Add a line break if it's not the last element in the section. if ($key < $numElements - 1) { $wordText .= PHP_EOL; } } } $formattedText = $wordText; Expected Behavior
A clear and concise description of what you expected to happen.
Current Behavior
What is the current behavior?
Context
Please fill in your environment information:
- PHP Version:
- PHPWord Version: