public function mergeSegment(Segment $segment)
    {
        if (! array_key_exists($segment->getName(), $this->segments)) {
            throw new OdfException($segment->getName() . 'cannot be parsed, has it been set yet ?');
        }
        $string = $segment->getName();
        // $reg = '@<text:p[^>]*>\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]<\/text:p>@smU';
        $reg = '@\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]@smU';
        $this->contentXml = preg_replace($reg, $segment->getXmlParsed(), $this->contentXml);
        foreach ($segment->manif_vars as $val) {
            $this->manif_vars[] = $val;   //copy all segment image names into current array
        }
        return $this;
    }
public function mergeSegment(Segment $segment)
    {
        if (! array_key_exists($segment->getName(), $this->segments)) {
            throw new OdfException($segment->getName() . 'cannot be parsed, has it been set yet ?');
        }
        $string = $segment->getName();
        // $reg = '@<text:p[^>]*>\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]<\/text:p>@smU';
        $reg = '@\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]@smU';
        $this->contentXml = preg_replace($reg, $segment->getXmlParsed(), $this->contentXml);
        foreach ($segment->manif_vars as $val) {
            $this->manif_vars[] = $val;   //copy all segment image names into current array
        }
        return $this;
    }
public function mergeSegment ( Segment $ segment ) { if ( ! array_key_exists ( $ segment -> getName ( ) , $ this -> segments ) ) { throw new OdfException ( $ segment -> getName ( ) . 'cannot be parsed, has it been set yet ?' ) ; } $ string = $ segment -> getName ( ) ; // $reg = '@<text:p[^>]*>\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]<\/text:p>@smU'; $ reg = '@\[!--\sBEGIN\s' . $ string . '\s--\](.*)\[!--.+END\s' . $ string . '\s--\]@smU' ; $ this -> contentXml = preg_replace ( $ reg , $ segment -> getXmlParsed ( ) , $ this -> contentXml ) ; foreach ( $ segment -> manif_vars as $ val ) { $ this -> manif_vars [ ] = $ val ; //copy all segment image names into current array } return $ this ; }
Add the merged segment to the document

@param Segment $segment
@throws OdfException
@return odf
Add the merged segment to the document