Replies: 4   Views: 4095
Paragraph styles not behaving as expected...
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 AndrewCooper  · 03-06-2016 - 07:39


In the examples for the createParagraphStyles (sample_1.php), I added "font" and "sz" to the style array.  Like so...

$style = array(
    'color' => '999999',
    'border' => 'single',
    'borderLeft' => 'double',
    'borderColor' => '990000',
    'borderRightColor' => '000099',
    'borderWidth' => 12,
    'borderTopWidth' => 24,
    'indentLeft' => 920,
    'font' => "Arial",
    'sz' => "48"

Here's the problem.  It doesn't matter what I change the font to: Arial, Garamond, whatnot. It doesn't make any difference. It always uses the default Calibri font.

Also, the sz attribute causes the size of the font to change but at half of the value I put in. In the example I gave above the font ends up being Calibri at a size of 24. While this difference seems to be consistent and I could work with it, I'd like to know the reason this is happening.



Posted by admin  · 03-06-2016 - 08:54


To be able to show fonts they need to be installed in your OS. For example if you're using LibreOffice in a Linux server and you set Arial as font-family, you need to install this font.

About the sz values, Word uses halfpoints to set text sizes. You need to put the corresponding value, this is size/2.


Posted by AndrewCooper  · 03-06-2016 - 09:08

Okay.  I get the size thing then.  

Wait... I need to install the font on the web server or on the client machine?  I have all the fonts I've tried on the client machine.  When I open the created document in Word, I can click on the dropdown box for font and find the font I want. 


Posted by AndrewCooper  · 03-06-2016 - 09:34

I found the issue.  After making the code change, if I don't do a Hard Reload, it uses the same values as before.  It was a caching thing.  Thanks, admin.  It seems to be working as expected now.