1

I'm adding html to phpword of an unordered list. Font styles pull through fine (on the list items), but paragraph styles are completely ignored.

This on my list item works fine:

<li style='font-size: 10pt; font-family: Arial; color:#595959>

But no matter what I do I can't get paragraph styles to pull through to Word. When I open the docx and look at the paragraph format in Word, it says the spacing before and after are both "0" and the line spacing field is blank.

I've tried adding paragraph styles to the <li>'s using line-height, and/or margin-bottom, and/or margin-top:

<li style='line-height: 170%'>

I've tried with % units as well as px and em units. I've also tried the same thing on the <ul>:

<ul style='line-height: 170%'>

I've tried adding <p>'s into the <li>'s:

<li><p style='font-size: 15pt; font-family: Arial; color:#FF0000; line-height: 140%; margin-bottom: 160pt;'>Hello</p></li>

Again, the font styles work, but line-height styles completely ignored. I've even tried deleting the <ul>'s but that obviously didn't work. Ditto with trying all above with <ol> but same thing.

Is this a known issue? Or am I in for a "doh!" moment of having missed something obvious?

Thank you!

I'm using phpword 0.17 and opening my docx in Word for Mac, v16.

Nicolas Goosen
  • 583
  • 5
  • 14

0 Answers0