Create a text with a newspaper style (sample 05 is not working)?

Sep 22, 2015 at 7:16 PM
I'm Trying use the sample 05 on phpword to create a text with Multi Columns (like a newspaper).

The sample here:

But using the sample 05 is not working, an error appears saying

"Call to a member function addSection() on null"

Can somebody give me a another example to how to do this?

This is my code:

require_once 'PHPWord.php';
 // New Word Document
 $PHPWord = new PHPWord();

 // New portrait section
  $section = $PHPWord->createSection();

 // Two columns text
     $section = $phpWord->addSection(
        'colsNum'   => 2,
        'colsSpace' => 1440,
        'breakType' => 'continuous',

$section->addText(htmlspecialchars("Two columns, one inch (1440 twips) spacing.", ENT_COMPAT, 'UTF-8'));

// Save File
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');