Skip to content

Commit 2d1b52b

Browse files
committed
Merge branch 'support_for_xe_and_index_field' into develop
2 parents 373039c + 2b4b200 commit 2d1b52b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/PhpWord/Writer/Word2007/Element/Field.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function write()
6464
$xmlWriter->endElement(); // w:r
6565

6666
if ($element->getText() != null) {
67-
if ($element->getText() instanceof PhpOffice\PhpWord\Element\TextRun) {
67+
if ($element->getText() instanceof \PhpOffice\PhpWord\Element\TextRun) {
6868

6969
$containerWriter = new Container($xmlWriter, $element->getText(), true);
7070
$containerWriter->write();

tests/PhpWord/Writer/Word2007/ElementTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ public function testFieldElement()
198198
$phpWord = new PhpWord();
199199
$section = $phpWord->addSection();
200200

201-
$section->addField('INDEX', [], ['\\c "3"']);
202-
$section->addField('XE', [], ['Bold', 'Italic'], 'Index Entry');
203-
$section->addField('DATE', ['dateformat' => 'd-M-yyyy'], ['PreserveFormat', 'LastUsedFormat']);
204-
$section->addField('DATE', [], ['LunarCalendar']);
205-
$section->addField('DATE', [], ['SakaEraCalendar']);
206-
$section->addField('NUMPAGES', ['format' => 'roman', 'numformat' => '0,00'], ['SakaEraCalendar']);
201+
$section->addField('INDEX', array(), array('\\c "3"'));
202+
$section->addField('XE', array(), array('Bold', 'Italic'), 'Index Entry');
203+
$section->addField('DATE', array('dateformat' => 'd-M-yyyy'), array('PreserveFormat', 'LastUsedFormat'));
204+
$section->addField('DATE', array(), array('LunarCalendar'));
205+
$section->addField('DATE', array(), array('SakaEraCalendar'));
206+
$section->addField('NUMPAGES', array('format' => 'roman', 'numformat' => '0,00'), array('SakaEraCalendar'));
207207
$doc = TestHelperDOCX::getDocument($phpWord);
208208

209209
$element = '/w:document/w:body/w:p/w:r/w:instrText';
@@ -219,7 +219,7 @@ public function testFieldElementWithComplexText()
219219
$text = new TextRun();
220220
$text->addText('test string', array('bold' => true));
221221

222-
$section->addField('XE', [], ['Bold', 'Italic'], $text);
222+
$section->addField('XE', array(), array('Bold', 'Italic'), $text);
223223
$doc = TestHelperDOCX::getDocument($phpWord);
224224

225225
$element = '/w:document/w:body/w:p/w:r[2]/w:instrText';

0 commit comments

Comments
 (0)