Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP WORD reader - how to access the “Scale” property of a font #1853

Closed
SPG1982 opened this issue Apr 19, 2020 · 1 comment
Closed

PHP WORD reader - how to access the “Scale” property of a font #1853

SPG1982 opened this issue Apr 19, 2020 · 1 comment

Comments

@SPG1982
Copy link

SPG1982 commented Apr 19, 2020

I read the .docx file with the PHPWORD library. When iterating over the "sections" array, I get access to the "TextRun" element, in which I iterate over the "Text"elements (objects). The "Text" object has properties that are obtained using the $font = $text->getFontStyle () method. There is very little information about readers in the documentation. Reading properties using the method $fontFamily = $font->getName(). The size, color, and so on properties are read normally, but the "scale" property and some other properties are always empty. Who can tell you how to pull properties from the text? What was tried: different versions of the PHPWord library, viewing the entire object after reading $phpWord = $objReader->load($filename); debug($phpWord); does not give a positive result (the object is larger, but there are no properties anywhere either). Another feature noticed is that if the text style is set by default, the font size property remains empty, and if the font is changed, the value appears. The scale of course changed in different values in the document, but the value did not appear in the property. Is the reader working incorrectly? How to fix it. Thanks.

@SPG1982
Copy link
Author

SPG1982 commented Apr 19, 2020

It was decided independently. The problem is that the vendor\phpoffice\phpword\src\PhpWord\Reader\2007\AbstractPart class has a readFontStyle () method that generates default fields for reading in the $styleDefs variable (array). In these fields, add 'spacing'=> array(self::READ_VALUE, 'w:spacing'), 'scale' => array (self::READ_VALUE, 'w:w'). It is not clear why these fields were not there in the first place. It doesn't affect the speed in any way.

The question is closed.

@SPG1982 SPG1982 closed this as completed Apr 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant