Office Open XML bullet list

ε祈祈猫儿з 提交于 2019-12-12 12:15:00

问题


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


回答1:


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!

So be careful!



来源:https://stackoverflow.com/questions/36909840/office-open-xml-bullet-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!