Snippets

Get font size from a content

DOCX applies cascade styles: the more specific the style, the more priority it has.

This way, inline styles take precedence over custom styles. Next, custom styles have priority over content default styles, and those take precedence over document default styles.

phpdocx allows to get all the styles of a document, e.g., to obtain the font size of a paragraph:

An almost identical code can be run to obtain other properties like font family, colors, spacingsā€¦ just checking the relevant tag.