I am using PHPWord to ger nerate word elements. I want to insert a bulleted list using setValue in my template.
I tried inserting this snippet
<w:p>
<w:pPr>
<w:pStyle w:val="ListParagraph"/>
<w:numPr>
<w:ilvl w:val="0"/>
<w:numId w:val="1"/>
</w:numPr>
</w:pPr>
<w:r>
<w:t>One</w:t>
</w:r>
</w:p>
But somehow I am missing the style. where do I need to insert the style and what style?
I worked based on that page: https://msdn.microsoft.com/de-de/library/office/ee922775%28v=office.14%29.aspx
The <w:pStyle>
element takes the style ID as its w:val
attribute. So in this case, the 'List Paragraph' style. List Paragraph
does not have a bullet. If you want a bullet you'll need to use List Bullet
instead.
Note that this will only actually work if the style in question is explicitly defined in the /word/styles.xml
part. The List Bullet
style is a so-called 'built-in' style, and is not written by Word into the styles.xml part until it is used for the first time.
So it's possible you may need to add it yourself. The Word behavior when a paragraph is assigned an undefined style is simply to use the default paragraph style, probably Normal
.