PHPWord read word documents preserving the styles
I have successfully extracted the text content in a word file using phpWord and the following code: <?php require_once 'vendor/autoload.php'; // Read contents $name = 'linux'; $source = "{$name}.docx"; echo date('H:i:s'), " Reading contents from {$source} <hr>"; $phpWord = \PhpOffice\PhpWord\IOFactory::load($source); $sections = $phpWord->getSections(); foreach ($sections as $key => $value) { $sectionElement = $value->getElements(); foreach ($sectionElement as $elementKey => $elementValue) { if ($elementValue instanceof \PhpOffice\PhpWord\Element\TextRun) { $secondSectionElement =