diff --git a/Classes/PHPWord/Section.php b/Classes/PHPWord/Section.php index bdf37f81..63eeaf03 100755 --- a/Classes/PHPWord/Section.php +++ b/Classes/PHPWord/Section.php @@ -422,6 +422,9 @@ class PHPWord_Section */ public function getFooter() { + if (!($this->_footer instanceOf PHPWord_Section_Footer)) { + $this->_footer = new PHPWord_Section_Footer($this->_sectionCount); + } return $this->_footer; } diff --git a/Classes/PHPWord/Writer/Word2007.php b/Classes/PHPWord/Writer/Word2007.php index 8d112d47..8d2e5e28 100755 --- a/Classes/PHPWord/Writer/Word2007.php +++ b/Classes/PHPWord/Writer/Word2007.php @@ -139,14 +139,12 @@ class PHPWord_Writer_Word2007 implements PHPWord_Writer_IWriter } $_footer = $section->getFooter(); - if (!is_null($_footer)) { - $_cFtrs++; - $_footer->setRelationId(++$rID); - $_footerCount = $_footer->getFooterCount(); - $_footerFile = 'footer' . $_footerCount . '.xml'; - $sectionElements[] = array('target' => $_footerFile, 'type' => 'footer', 'rID' => $rID); - $objZip->addFromString('word/' . $_footerFile, $this->getWriterPart('footer')->writeFooter($_footer)); - } + $_cFtrs++; + $_footer->setRelationId(++$rID); + $_footerCount = $_footer->getFooterCount(); + $_footerFile = 'footer' . $_footerCount . '.xml'; + $sectionElements[] = array('target' => $_footerFile, 'type' => 'footer', 'rID' => $rID); + $objZip->addFromString('word/' . $_footerFile, $this->getWriterPart('footer')->writeFooter($_footer)); } if (PHPWord_Footnote::countFootnoteElements() > 0) {