diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php
index dcf84778..f8b25605 100644
--- a/src/PhpWord/Shared/Html.php
+++ b/src/PhpWord/Shared/Html.php
@@ -521,7 +521,18 @@ class Html
$styles['bgColor'] = trim($cValue, '#');
break;
case 'line-height':
- $styles['lineHeight'] = Html::toMultiplier($cValue);
+ if (preg_match('/([0-9]+[a-z]+)/', $cValue, $matches)) {
+ $spacingLineRule = \PhpOffice\PhpWord\SimpleType\LineSpacingRule::EXACT;
+ $spacing = Converter::cssToTwip($matches[1]) / \PhpOffice\PhpWord\Style\Paragraph::LINE_HEIGHT;
+ } elseif (preg_match('/([0-9]+)%/', $cValue, $matches)) {
+ $spacingLineRule = \PhpOffice\PhpWord\SimpleType\LineSpacingRule::AUTO;
+ $spacing = ((int) $matches[1]) / 100;
+ } else {
+ $spacingLineRule = \PhpOffice\PhpWord\SimpleType\LineSpacingRule::AUTO;
+ $spacing = $cValue;
+ }
+ $styles['spacingLineRule'] = $spacingLineRule;
+ $styles['lineHeight'] = $spacing;
break;
case 'text-indent':
$styles['indentation']['firstLine'] = Converter::cssToTwip($cValue);
@@ -681,15 +692,6 @@ class Html
return null;
}
- private static function toMultiplier($cssValue)
- {
- if (preg_match('/([0-9]+)%/', $cssValue, $matches)) {
- return ((int) $matches[1]) / 100;
- }
-
- return $cssValue;
- }
-
/**
* Parse line break
*