Continuous sections

Oct 16, 2011 at 9:11 AM

Hi all,

first of all a big THANKS for making this library. I really hope that it's development will continue.

My question is: does anyone know how to insert continuous sections?

Best regards,


Oct 16, 2011 at 11:36 AM

I have found the solution!

the idea is toadd the XML node <w:type w:val="continuous"/>

as follows:

      <w:type w:val="continuous"/>
      <w:headerReference w:type="default" r:id="rId9"/>
      <w:pgSz w:w="11906" w:h="16838"/>
      <w:pgMar w:top="2300" w:right="1418" w:bottom="1500" w:left="1300" w:header="720" w:footer="720" w:gutter="0"/>
      <w:cols w:space="720"/>

I have modified the sources as follows:

PHPWord\Writer\Word2007\Document.php, function _writeEndSection, added:

            if(!is_null($_type)) {
                $objWriter->writeAttribute('w:val', $_type);


PHPWord\Section\Settings.php, class PHPWord_Section_Settings,

added new private variable    

     * Section Type
     * @var string
    private $_sectionType;


initialized it with null in the __constructor:

        $this->_sectionType = null;

and finally added setter and getter:

     * Set Section Type
     * @param string $pValue
    public function setSectionType($pValue = null) {
        $this->_sectionType = $pValue;
     * Get Section Type
     * @return string
    public function getSectionType() {
        return $this->_sectionType;


Usage example:

       $PHPWord = new PHPWord();
       $section = $PHPWord->createSection();
       $sectionStyle = $section->getSettings();

Oct 18, 2011 at 5:01 PM

This was a great help, and well documented -- only thing (I think) you forgot was to add to the _writeEndSection function in Document.php:

       $_type = $_settings->getSectionType();

Oct 19, 2011 at 9:58 AM

You're totally right Cindy!
I'll update my sources. Thanks.