Merge pull request #107 from gabrielbull/develop

Fixed bug with footer preserve text
This commit is contained in:
Progi1984 2014-03-11 20:27:02 +01:00
commit da7c0ad558
4 changed files with 27 additions and 9 deletions

View File

@ -285,6 +285,9 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart
$SpIsObject = ($styleParagraph instanceof PHPWord_Style_Paragraph) ? true : false;
$arrText = $textrun->getText();
if (!is_array($arrText)) {
$arrText = array($arrText);
}
$objWriter->startElement('w:p');

View File

@ -108,4 +108,19 @@ class BaseTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $element->getAttribute('w:val'));
}
}
public function testWritePreserveText()
{
$PHPWord = new PHPWord();
$section = $PHPWord->createSection();
$footer = $section->createFooter();
$footer->addPreserveText('{PAGE}');
$doc = TestHelperDOCX::getDocument($PHPWord);
$preserve = $doc->getElement("w:p/w:r[2]/w:instrText", 'word/footer1.xml');
$this->assertEquals('PAGE', $preserve->nodeValue);
$this->assertEquals('preserve', $preserve->getAttribute('xml:space'));
}
}

View File

@ -24,7 +24,7 @@
"ext-xml": "*"
},
"require-dev": {
"phpunit/phpunit": "3.7.28"
"phpunit/phpunit": "3.7.*"
},
"recommend": {
"ext-zip": "*",