Forum


Replies: 10   Views: 2996
Upgrade guide from version 5 corporate to 9 advanced
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 20-06-2019 - 14:06

Hello,

Although we have sent a sample script by e-mail, this is the code used to get the font size when using getWordStyles to query a style element:

$referenceNode = array(
    'type' => 'style',
    'contains' => 'Normal',
);

$contents = $docx->getWordStyles($referenceNode);
$size = null;
foreach ($contents as $content) {
        foreach ($content['style']['styles'] as $style) {
                if ($style['tag'] == 'w:sz') {
                        $size = $style['attributes']['w:val'];
                }
        }
}

print_r('Size: ' . $size . PHP_EOL);

Half-points are used to specify font sizes.

Regards.