none
numID = 0 clarification sought RRS feed

  • Question

  • Hopefully this is the right place to ask this question.

    I have a docX file and the numbering properties for a paragraph have a numId entry with the value of zero.

    According the ECMA specification a value of zero is used to designate the removal of numbering properties at a particular level in the style heierarchy (typically via direct formatting).

    The above is very vague and I can't tally this up with what I'm seeing, when I open the document and manipulate the XML contents. The main problem that I am seeing is:

    1) The referenced paragraph style has both indentation and justification set but indentation is NOT being picked up.

    I basically don't understand why indentation is not being picked up but justification is. Can anybody provide further clarification on the rules please. The only way I can get indentation to be picked up is by adding it as direct formatting.

     document.xml snippet

         <w:pPr>
            <w:pStyle w:val="Level1"/>
            <w:numPr>
              <w:ilvl w:val="0"/>
              <w:numId w:val="0"/>
            </w:numPr>
            <w:spacing w:before="120" w:after="0"/>
            <w:outlineLvl w:val="9"/>
            <w:rPr>
              <w:rStyle w:val="Level1asHeadingtext"/>
            </w:rPr>
          </w:pPr>
          <w:r w:rsidRPr="00D63957">
            <w:rPr>
              <w:rStyle w:val="Level1asHeadingtext"/>
            </w:rPr>
            <w:t>B</w:t>
          </w:r>

    Styles.xml snippet

     <w:style w:type="paragraph" w:customStyle="1" w:styleId="Level1">
        <w:name w:val="Level 1"/>
        <w:basedOn w:val="Normal"/>
        <w:rsid w:val="00A9320A"/>
        <w:pPr>
          <w:numPr>
            <w:numId w:val="1"/>
          </w:numPr>
          <w:spacing w:after="240" w:line="240" w:lineRule="auto"/>
          <w:outlineLvl w:val="0"/>
          <w:jc w:val="center"/>
          <w:ind w:left="3600" w:hanging="3600"/>
        </w:pPr>

    Thanks,

    Peter.

    Thursday, April 29, 2010 10:11 AM

All replies

  • Hi Peter,

    Thanks for your question.

    I don't quite understand what do you mean by "justification", do you mean the automatically displayed serial numer in Word? If not, could you describe a little more? According to your description, if you need to change the identation, you could refer to "w:ilvl" (NumberingLevelReference) and try to make some changes to the value of "w:val". Another issuse is that the numbering styles are defined "\word\numbering.xml", you may take a look at it to see how they are defined.

    Hope this helps. If you have any question, please let me know.

    Thanks,

    Lu

    Tuesday, May 4, 2010 8:56 AM
  • Thanks for your reply. Sorry I don't think I made myself very clear.

    I'm trying to understand the rules when numId is zero. When the document is displayed in Word the Level1 numbering properties are NOT applied to the text so that it does NOT appear numbered which according to the ECMA spec is the correct behaviour.

    However, some paragraph properties associated with the Level1 style are still being used to format the paragraph while others are not. For example out of the following Level1 paragraph properties the text justification value from <jc> is being used to center the text however the indentation values from <ind> is not being used at all. I'm confident that there are no other <ind> values that are getting in the way.

    As I need to parse the document and style information to format output, not knowing what formatting I can and can't pick up from the paragraph style in this case makes it very difficult.

          <w:spacing w:after="240" w:line="240" w:lineRule="auto"/>
          <w:outlineLvl w:val="0"/>
          <w:jc w:val="center"/>
          <w:ind w:left="3600" w:hanging="3600"/>

    Many thanks,

     

    Peter.

     

    Tuesday, May 4, 2010 9:27 AM
  • Hi Peter,

    Thanks for your clarification.

    I have tried the "w:ind" element and found it works well even when numID = 0. I think the problem is caused by the same value of "w:left" and "w:hanging" property. You could refer to "File Format Reference" of the Tool's Documentation section by searching "w:ind", and "hanging" specifies the indentation which shall be removed from the first line of the parent paragraph, by moving the indentation on the first line back towards the beginning of the direction of text flow. So if both the values of "w:left" and "w:hanging" are 3600, there will be no indentation as you see. In conclusion, the indentation of the first line of a paragraph should be "w:left" - "w:hanging".

    Hope this helps. If you have any question, please let me know.

    Thanks,

    Lu

    Wednesday, May 5, 2010 8:05 AM
  • Hi Lu,

    If I remove hanging then the text is still not indented. I appreciated that the hanging value resulted in the first line of text not being indented however experimentation and the remainder of the test document, over and above the first line, does show that indentation is not being picked up from the Level1 style hierarchy.

    When you say you modified w:ind did you modify it within the referenced style hierarchy or by directly formatting the paragraph? I agree that it is picked up when it is applied directly, i.e. within document.xml.

    It would help enormously if I could send you a docx file which highlights this problem?

    Many thanks,

    Peter.

     

    Wednesday, May 5, 2010 8:49 AM
  • Hi Peter,

    Thanks for your description.

    I modified w:ind in the ParagraphProperties which directly applies the format on the paragraph. I think you could share your docx file in SkyDrive with your Live ID.

    From my point of view, the problem that the style is not applied is due to the value of w:numId set to 0, for according to the schema:

    "A value of 0 for the val attribute shall never be used to point to a numbering definition instance, and shall instead only be used to designate the removal of numbering properties at a particular level in the style hierarchy (typically via direct formatting)."

    So the numbering style will never be referenced when w:ind = 0. If you need to apply the style when w:ind = 0, you'd better do it through direct formatting.

    BTW, I wonder why you need to set w:ind = 0 and then apply the numbering style. Could you describe a little more about your requirement? Your feedback is important to us.

    Hope this helps. If you have any question, please let me know.

    Thanks,

    Lu

    Thursday, May 6, 2010 2:25 AM
  • Hi Lu,

    Firstly the document that I am working with is a stripped down version of a real world document. I did not go out of my way to set numId to zero. I do not need to set w:ind or any settings, however, I do need to extract/parse the same settings that Word is using, however because the rules that Word is using do not make sense to me then it is proving difficult.

    Secondly, I agree with you that the numbering style information is not being picked up. However, Word is being selective about the settings that it is picking up from from the 'Level1' style, and its 'basedOn' hierarchy.

    I have uploaded the file to http://cid-2d11af626c37e0ed.skydrive.live.com/self.aspx/.Documents (in the only folder).

    If you unzip this document you'll notice that:

    1) Within 'Level1' style there is an indentation value that is NOT being used to format the document

    2) If you comment out the w:ind entry from the 'Level1' style and uncomment the 'w:jc' value then alignment DOES get used

    3) If you then uncomment the direct formatting 'w:ind' entry in document.xml then it gets picked up as expected.

    Given the above the question that I have is why Word uses some settings from 'Level1' style, such as alignment, but does not use the indentation values.

    Many thanks,

    Peter.

    Thursday, May 6, 2010 8:14 AM