Closed jptosso closed 6 years ago
Is your template created with a non-english version of word? 🤔
For lists to work the list numbering definition already needs to exist in the numbering.xml file (which is different from the document styles). I remember trying the same thing you did to make it work before I realized the difference. I haven't checked the README but there's a good chance we need to better document what's needed to successfully generate lists via html.
The easiest way to ensure the list numbering definition already exists is to create a numbered list and a bulleted list in the actual template using MS Word and then wrap them in Sablon comment tags so they don't appear in the final document. In my working templates I generally put examples of all the content types I'll be using (headings, tables, footnotes, captions, etc.) Inbetween a set of comment tags to ensure all of the required styles and such already exist in the document because I've found MS Word won't always include them.
@siegy22 I've lost track of the document but I think it was a non-english version, while mine is the english version. But it's not like I can recreate this document, it's huge.
@stadelmanma I've tried what you suggested without success :(
I've encountered the same problem. Adding lists to the template didn't help - it didn't create ListBullet
definition in neither numbering.xml
nor styles.xml
. I've managed to work around this by downloading insertion_template.docx and modifying it according to my needs (it wasn't necessary to add lists).
I'm not sure what to do if MS Word does not create a ListBullet styled abstract number definition if you explicitly create a Bulleted list with that style in the template. numbering.xml
is the key file here, the styles.xml
doesn't have a role in defining lists. List definitions are rather complex which is why sablon doesn't try to generate a missing one on it's own.
However, one catch is that a "list with bullets" (or numbers) won't always do the trick unless it's style is exactly ListBullet
or ListNumber
since those are the style strings searched for. You can override that by adding a pStyle rule to the style attribute of the <ul>
or <ol>
element (i.e. <ul style="pStyle: Custom;">...</ul>
). This is a workable solution if MS Word actually uses something other than the expected styles when you are creating lists.
@asdfuken you appear to have done everything correct based on your screen shot, I would suggest unzipping your document and viewing the word/numbering.xml
to see what definitions are present. I'm otherwise at a loss. If it is a file you are able to share with the world you can attach it to a comment and I'll take a look myself. (@grstk you would be welcome to as well if you want).
Below is an example of what sablon searches for in numbering.xml
:
<w:abstractNum w:abstractNumId="13" w15:restartNumberingAfterBreak="0">
<w:multiLevelType w:val="multilevel"/>
<w:tmpl w:val="721C1DCE"/>
<w:lvl w:ilvl="0">
<w:start w:val="1"/>
<w:numFmt w:val="decimal"/>
<w:pStyle w:val="ListNumber"/> <!-- this is the key line -->
<w:lvlText w:val="%1."/>
...
</w:lvl>
...
</w:abstractNum>
Thank you everyone, I've found the problem !!!! Word uses two group of styles, it seems like one group is linked to the software and another is linked to the document. When you create a new style it MUST BE DEFINED AS PARAGRAPH, not a list or it will not appear on the style list.
Thank you everyone for your help !!!
Right list:
Wrong list:
Closing this as resolved.
@jptosso thank you, you saved me some time
Hello, every time I try to use HTML lists I get the following error: Could not find w:abstractNum definition for style: 'ListBullet'. In the testing files it works fine so I can't find the problem here. I've tried to create custom style ListBullet for lists but nothing happened.
Thank you