parse fixed line space
This commit is contained in:
parent
97d60dd985
commit
de01e86d41
@ -521,7 +521,18 @@ class Html
|
|||||||
$styles['bgColor'] = trim($cValue, '#');
|
$styles['bgColor'] = trim($cValue, '#');
|
||||||
break;
|
break;
|
||||||
case 'line-height':
|
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;
|
break;
|
||||||
case 'text-indent':
|
case 'text-indent':
|
||||||
$styles['indentation']['firstLine'] = Converter::cssToTwip($cValue);
|
$styles['indentation']['firstLine'] = Converter::cssToTwip($cValue);
|
||||||
@ -681,15 +692,6 @@ class Html
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function toMultiplier($cssValue)
|
|
||||||
{
|
|
||||||
if (preg_match('/([0-9]+)%/', $cssValue, $matches)) {
|
|
||||||
return ((int) $matches[1]) / 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $cssValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse line break
|
* Parse line break
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user