Fixed bug with footer preserve text
This commit is contained in:
parent
0b876a3f0b
commit
72fca30e8c
|
|
@ -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');
|
||||
|
||||
|
|
|
|||
|
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
"ext-xml": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "3.7.28"
|
||||
"phpunit/phpunit": "3.7.*"
|
||||
},
|
||||
"recommend": {
|
||||
"ext-zip": "*",
|
||||
|
|
|
|||
Loading…
Reference in New Issue