none
Restarting of numbering in Word OOXML files RRS feed

  • Question

  • Please could anyone help me work out how the restarting of numbering works in OOXML word files? I've compared two files from Word, one with the numbering restarted and the other continous but I can't figure out how the restarting how it works.

    Cheers,
    Graham
    Saturday, October 13, 2007 4:36 PM

Answers

  •  

    To restart the numbering, it seems you have to add a numbering definition in numbering.xml of the package and refer it in document.xml of the same package.

     

    Document.xml:

    Code Block
            <w:p w:rsidR="00496647" w:rsidRDefault="00496647" w:rsidP="003F7500">
                <w:pPr>
                    <w:pStyle w:val="ListParagraph"/>
                    <w:numPr>
                        <w:ilvl w:val="0"/>
                        <w:numId w:val="1"/>
                    </w:numPr>
                    <w:ind w:left="360"/>
                </w:pPr>
                <w:r>
                    <w:t>Numbered line one here.</w:t>
                </w:r>
            </w:p>
            <w:p w:rsidR="00712EA0" w:rsidRDefault="0041143B" w:rsidP="0041143B">
                <w:r>
                    <w:t>Non-numbering line here.</w:t>
                </w:r>
            </w:p>
            <w:p w:rsidR="0041143B" w:rsidRDefault="0041143B" w:rsidP="0041143B"/>
            <w:p w:rsidR="003F7500" w:rsidRDefault="0041143B" w:rsidP="003F7500">
                <w:pPr>
                    <w:pStyle w:val="ListParagraph"/>
                    <w:numPr>
                        <w:ilvl w:val="0"/>
                        <w:numId w:val="2"/>
                    </w:numPr>
                    <w:ind w:left="360"/>
                </w:pPr>
                <w:r>
                    <w:t>Numbering for this line will be re-started here.</w:t>
                </w:r>
            </w:p>

     

     

    Numbering.xml:

    Code Block

        <w:abstractNum w:abstractNumId="0">
            <w:lvl w:ilvl="0" w:tplc="0409000F">
                <w:start w:val="1"/>
                <w:numFmt w:val="decimal"/>
                <w:lvlText w:val="%1."/>
                <w:lvlJc w:val="left"/>
                <w:pPr>
                    <w:ind w:left="720" w:hanging="360"/>
                </w:pPr>
                <w:rPr>
                    <w:rFonts w:hint="default"/>
                </w:rPr>
            </w:lvl>
        </w:abstractNum>
        <w:abstractNum w:abstractNumId="1">
            <w:lvl w:ilvl="0" w:tplc="6A768A72">
                <w:start w:val="1"/>
                <w:numFmt w:val="decimal"/>
                <w:lvlText w:val="%1."/>
                <w:lvlJc w:val="left"/>
                <w:pPr>
                    <w:ind w:left="720" w:hanging="360"/>
                </w:pPr>
                <w:rPr>
                    <w:rFonts w:hint="default"/>
                </w:rPr>
            </w:lvl>
        </w:abstractNum>
        <w:num w:numId="1">
            <w:abstractNumId w:val="0"/>
        </w:num>
        <w:num w:numId="2">
            <w:abstractNumId w:val="1"/>
        </w:num>
    </w:numbering>

     

    Monday, October 15, 2007 1:51 AM

All replies

  •  

    To restart the numbering, it seems you have to add a numbering definition in numbering.xml of the package and refer it in document.xml of the same package.

     

    Document.xml:

    Code Block
            <w:p w:rsidR="00496647" w:rsidRDefault="00496647" w:rsidP="003F7500">
                <w:pPr>
                    <w:pStyle w:val="ListParagraph"/>
                    <w:numPr>
                        <w:ilvl w:val="0"/>
                        <w:numId w:val="1"/>
                    </w:numPr>
                    <w:ind w:left="360"/>
                </w:pPr>
                <w:r>
                    <w:t>Numbered line one here.</w:t>
                </w:r>
            </w:p>
            <w:p w:rsidR="00712EA0" w:rsidRDefault="0041143B" w:rsidP="0041143B">
                <w:r>
                    <w:t>Non-numbering line here.</w:t>
                </w:r>
            </w:p>
            <w:p w:rsidR="0041143B" w:rsidRDefault="0041143B" w:rsidP="0041143B"/>
            <w:p w:rsidR="003F7500" w:rsidRDefault="0041143B" w:rsidP="003F7500">
                <w:pPr>
                    <w:pStyle w:val="ListParagraph"/>
                    <w:numPr>
                        <w:ilvl w:val="0"/>
                        <w:numId w:val="2"/>
                    </w:numPr>
                    <w:ind w:left="360"/>
                </w:pPr>
                <w:r>
                    <w:t>Numbering for this line will be re-started here.</w:t>
                </w:r>
            </w:p>

     

     

    Numbering.xml:

    Code Block

        <w:abstractNum w:abstractNumId="0">
            <w:lvl w:ilvl="0" w:tplc="0409000F">
                <w:start w:val="1"/>
                <w:numFmt w:val="decimal"/>
                <w:lvlText w:val="%1."/>
                <w:lvlJc w:val="left"/>
                <w:pPr>
                    <w:ind w:left="720" w:hanging="360"/>
                </w:pPr>
                <w:rPr>
                    <w:rFonts w:hint="default"/>
                </w:rPr>
            </w:lvl>
        </w:abstractNum>
        <w:abstractNum w:abstractNumId="1">
            <w:lvl w:ilvl="0" w:tplc="6A768A72">
                <w:start w:val="1"/>
                <w:numFmt w:val="decimal"/>
                <w:lvlText w:val="%1."/>
                <w:lvlJc w:val="left"/>
                <w:pPr>
                    <w:ind w:left="720" w:hanging="360"/>
                </w:pPr>
                <w:rPr>
                    <w:rFonts w:hint="default"/>
                </w:rPr>
            </w:lvl>
        </w:abstractNum>
        <w:num w:numId="1">
            <w:abstractNumId w:val="0"/>
        </w:num>
        <w:num w:numId="2">
            <w:abstractNumId w:val="1"/>
        </w:num>
    </w:numbering>

     

    Monday, October 15, 2007 1:51 AM
  • i've done all these what u said but the problem is still there

    numbering is still continued

    i think something is missing out here which should be updated

    Wednesday, August 11, 2010 8:31 AM
  • Yonggang Li's solution worked for me, but it sure was a pain. Some things I had to do:

    • Make sure every numbered list points to a unique w:num
    • Make sure every w:num points to a unique w:abstractNum (seems strange)
    • Make sure all the w:abstractNum's appear before all the w:num's in the file
    • Make sure the 8 digit hex values (e.g. 6A768A72) are unique

    I was putting a template document into main document repeatedly, so every time I had to add a fresh batch of uniquely numbered abstractNum's and num's and make sure everything referenced properly.

    This was probably the best solution for me because I was adding to an existing code base, but if you're doing something from scratch you should probably look here and see if there might be an easier way: http://www.codeplex.com/powertools


    • Edited by tarehart Friday, October 7, 2011 2:07 PM
    Friday, October 7, 2011 2:05 PM
  • I searched for a couple days trying to figure out why the first instance of a w:num element for a given w:ilvl did not start at one when the w:start was clearly one.

     

    In the following situation, if a previous instance of the given w:num item exists earlier in the document for a higher w:ilvl, the absent lower w:ilvl is still considered to exist for numbering purposes:

     

    Code:

    <w:p w:rsidR="00496647" w:rsidRDefault="00496647" w:rsidP="003F7500">
    	<w:pPr>
    		<w:pStyle w:val="ListParagraph"/> 
    		<w:numPr> 
    			<w:ilvl w:val="1"/>  //*** ilvl=1 comes before first ilvl=0
    			<w:numId w:val="1"/> 
    		</w:numPr> <w:ind w:left="360"/> 
    	</w:pPr> 
    	<w:r> 
    		<w:t>Numbered line at level 1.</w:t> 
    	</w:r> 
    </w:p> 
    <w:p w:rsidR="003F7500" w:rsidRDefault="0041143B" w:rsidP="003F7500"> 
    	<w:pPr> 
    		<w:pStyle w:val="ListParagraph"/> 
    		<w:numPr> 
    			<w:ilvl w:val="0"/> //*** previous ilvl=0 is assumed because previous ilvl=1 exists for this numId
    			<w:numId w:val="1"/>
    		</w:numPr> 
    		<w:ind w:left="360"/> 
    	</w:pPr> 
    	<w:r> 
    		<w:t>Numbered line two at level 0. Though no w:ilvl=0 tag exists, one is assumed</w:t> 
    	</w:r> 
    </w:p>



    • Edited by clorkster Thursday, October 13, 2011 3:24 PM
    • Proposed as answer by clorkster Thursday, October 13, 2011 3:24 PM
    Thursday, October 13, 2011 3:16 PM