addSection(); $html='

Adding element via HTML

'; $html.='

Some well formed HTML snippet needs to be used

'; $html.='

With for example some inline formatting'; \PhpOffice\PhpWord\Shared\Html::addHtml($section, $html); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; }