Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Office Open XML bullet list

I'm trying to create a office open xml document with a bullet list in it. But instead of showing the bullets, the document shows a numbered list.

This is what I look for:

  • Paragraph 1
  • Paragraph 2

And instead I get the following list:

  1. Paragraph 1
  2. Paragraph 2

I already deeply digged the Web and Googled a lot. I read the documentation from http://officeopenxml.com/anatomyofOOXML.php and from the following resources:

  • https://msdn.microsoft.com/en-us/library/ee922775(office.14).aspx
  • https://msdn.microsoft.com/en-us/library/office/ee922775(v=office.14).aspx

and on StackOverflow as well.

I also already tried to create a new Word document with a bullet list in it and then I copied the code from the file itself without success. This is the content of my numbering.xml file:

<w:numbering [all namespaces follow]>
<w:abstractNum w:abstractNumId="0">
    <w:multiLevelType w:val="multilevel"/>
    <w:lvl w:ilvl="0">
        <w:start w:val="1"/>
        <w:numFmt w:val="bullet"/>
        <w:lvlText w:val=""/>
        <w:lvlJc w:val="left"/>
        <w:pPr>
            <w:tabs>
                <w:tab w:val="num" w:pos="720"/>
            </w:tabs>
            <w:ind w:left="720" w:hanging="720"/>
        </w:pPr>
        <w:rPr>
            <w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/>
        </w:rPr>
    </w:lvl>
    ... Other levels omitted ...
</w:abstractNum>
<w:num w:numId="1">
    <w:abstractNumId w:val="0"/>
</w:num>
</w:numbering>

While this is what I have in my document.xml (only the relevant part)

<w:p>
    <w:pPr>
        <w:numPr>
            <w:ilvl w:val="0"/>
            <w:numId w:val="1"/>
        </w:numPr>
    </w:pPr>
    <w:r>
        <w:t>
            Paragraph 1
        </w:t>
    </w:r>
</w:p>

Already tried with/without style information, different fonts, different symbols, ...

I'm using a XSLT sheet to create all the XML files, the folder structure and the final .docx file (the transformation is called from within a Java application)

Thank you

like image 373
chobin Avatar asked Oct 19 '22 10:10

chobin


1 Answers

Solved.

I did the "mistake" of doing a copy+paste from Internet of the following line:

<Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/>

But the original line had two invisible characters in the word numbering between the b and the e! Very hard to find. I found it thanks to my IDE which highlighted a typo!

The typo as shown in IntelliJ

So be careful!

like image 93
chobin Avatar answered Nov 03 '22 00:11

chobin