none
Unable to solve an XML bulleted list issue RRS feed

  • Question

  • Hi, I am working with the 'document.xml's code inside a word document. I've created PHP functions to search in the XML code and replace some parts so I can modify the Word Document's contents to fit my specific needs. Everything works fine except for bulleted lists, as numbers are displayed instead of bullets and spacing is different. Here is the code for a bullet list paragraph/element:

    - <w:p w:rsidR="006905B1" w:rsidRDefault="006905B1" w:rsidP="006905B1">
    - <w:pPr>
      <w:pStyle w:val="ListParagraph" /> 
    - <w:numPr>
      <w:ilvl w:val="0" /> 
      <w:numId w:val="1" /> 
      </w:numPr>
    - <w:rPr>
      <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" /> 
      <w:b w:val="0" /> 
      <w:sz w:val="24" /> 
      <w:szCs w:val="24" /> 
      </w:rPr>
      </w:pPr>
    - <w:r>
    - <w:rPr>
      <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" /> 
      <w:b w:val="0" /> 
      <w:sz w:val="24" /> 
      <w:szCs w:val="24" /> 
      </w:rPr>
      <w:t xml:space="preserve">Point1</w:t> 
      </w:r>
      </w:p>
    
    

    Using this code in a blank document usually works fine. However, in my document, this list is displayed inside a box. Here is a picture of what I get followed by a picture of what I want:

     
    As I read the informations about this matter from Microsoft's website, I've tried multiple things to solve the problem without any success. I've tried to modify the <w:numId w:val="1" /> value, I've tried to save changes inside the Word Document, then copy the corresponding XML code from the document.xml file and insert it myself afterwards in an other document, but it surprisingly doesn't work. This means I had two different documents with the exact same code for the bulleted list, one working and one not working (the one I manually inserted the code).

    This makes me wonder if there is other parameters outside of the paragraph's code which I should consider? As I wrote it earlier, if I use this XML code outside of the box shown in the attached pictures, it works fine, but inside the box, numbers appear instead of bullets and the spacing is different. After trying to add/modify multiple parameters, nothing worked and some help would be much appreciated.

    Thanks!

    Wednesday, December 21, 2011 11:21 PM

Answers

  • Hi Jmvicent,

    Thank you for posting.

    Did you miss the NumberingDefinitionsPart part xml? Please refer to this article on MSDN:

    http://msdn.microsoft.com/en-us/library/ee922775.aspx

    The article says that "For the simple bulleted list, the main document part (document.xml) contains paragraphs that are identical to the simple numbered list.", but the numbering part is different:

    <w:abstractNum w:abstractNumId="0">
      <w:lvl w:ilvl="0">
        <w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="o"/><w:lvlJc w:val="left"/>
        <w:pPr>
          <w:ind w:left="720"
                 w:hanging="360"/>
        </w:pPr>
        <w:rPr>
          <w:rFonts w:ascii="Symbol"
                    w:hAnsi="Symbol"
                    w:hint="default"/>
        </w:rPr>
      </w:lvl>
      <!-- several w:lvl elements elided -->
      <w:num w:numId="1">
        <w:abstractNumId w:val="0"/>
      </w:num>
    </w:numbering>
    Did you forgot to consider it?

    Hope this can give you some hint and just feel free to follow up after you have tried.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Bruce Song Wednesday, January 4, 2012 8:00 AM
    Friday, December 23, 2011 7:31 AM