Forum


Replies: 10   Views: 277
Upgrade guide from version 5 corporate to 9 advanced

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.