diff --git a/src/PhpWord/Style/AbstractStyle.php b/src/PhpWord/Style/AbstractStyle.php index 8167c4d2..13ef8f9b 100644 --- a/src/PhpWord/Style/AbstractStyle.php +++ b/src/PhpWord/Style/AbstractStyle.php @@ -245,7 +245,7 @@ abstract class AbstractStyle if (is_string($value) && (preg_match('/[^\d\.\,]/', $value) == 0)) { $value = floatval($value); } - if (!is_float($value)) { + if (!is_numeric($value)) { $value = $default; } diff --git a/src/PhpWord/Style/Image.php b/src/PhpWord/Style/Image.php index f816b32f..1de51870 100644 --- a/src/PhpWord/Style/Image.php +++ b/src/PhpWord/Style/Image.php @@ -250,7 +250,7 @@ class Image extends AbstractStyle */ public function setMarginTop($value = 0) { - $this->marginTop = $this->setFloatVal($value, 0); + $this->marginTop = $this->setNumericVal($value, 0); return $this; } @@ -273,7 +273,7 @@ class Image extends AbstractStyle */ public function setMarginLeft($value = 0) { - $this->marginLeft = $this->setFloatVal($value, 0); + $this->marginLeft = $this->setNumericVal($value, 0); return $this; }