From 09e5e352a994ffabf6437fc9e4367464a3d76997 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Wed, 21 Oct 2015 21:44:10 +0400 Subject: [PATCH] Changed init value of the NumberingLevel.alignment property. --- src/PhpWord/Style/NumberingLevel.php | 2 +- src/PhpWord/Writer/Word2007/Part/Numbering.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PhpWord/Style/NumberingLevel.php b/src/PhpWord/Style/NumberingLevel.php index 50272a2a..91f40df2 100644 --- a/src/PhpWord/Style/NumberingLevel.php +++ b/src/PhpWord/Style/NumberingLevel.php @@ -85,7 +85,7 @@ class NumberingLevel extends AbstractStyle /** * @var string */ - private $alignment; + private $alignment = ''; /** * Left diff --git a/src/PhpWord/Writer/Word2007/Part/Numbering.php b/src/PhpWord/Writer/Word2007/Part/Numbering.php index 742aecc2..e7a354d5 100644 --- a/src/PhpWord/Writer/Word2007/Part/Numbering.php +++ b/src/PhpWord/Writer/Word2007/Part/Numbering.php @@ -114,11 +114,12 @@ class Numbering extends AbstractPart 'pStyle' => 'pStyle', 'suffix' => 'suff', 'text' => 'lvlText', - 'alignment' => 'lvlJc' + 'alignment' => 'lvlJc', ); foreach ($properties as $property => $nodeName) { $getMethod = "get{$property}"; - if (!is_null($level->$getMethod())) { + if ('' !== $level->$getMethod() // this condition is now supported by `alignment` only + && !is_null($level->$getMethod())) { $xmlWriter->startElement("w:{$nodeName}"); $xmlWriter->writeAttribute('w:val', $level->$getMethod()); $xmlWriter->endElement(); // w:start