none
Actual auto numbers of word document are not reading using OpenXML RRS feed

  • Question

  • Hi,

    We use openXML in our application to read the word document content. And before we start to read actual document content we use openxml FormattingAssembler class(https://github.com/VisualOn/OpenXmlPowerTools-old/blob/master/FormattingAssembler.cs) and ListItemRetriver class (https://github.com/VisualOn/OpenXmlPowerTools-old/blob/master/ListItemRetriever.cs)  to read the list numbers/Auto numbers of the document. 

    I have a document where after section break the auto numbers are resetting from 1 but even though the numbers are reset and have values are starting from 1, Open Xml is reading auto numbers continuously.

    Ex : In the attached document I have marked the paragraphs in yellow whose values are changing. In page no 2 the paragraphs are starting from 1 but it is reading as 6 which is continuous from first page and rest of the auto numbers are also read wrongly that is after 6 it is read as 7 instead of 2.

    Is there any way how we can make auto numbers to reset after section break or How to read the actual auto number of the document after section break ?

    Thanks,
    Gayatri
    Tuesday, September 4, 2018 1:34 PM

All replies

  • Hi GayatriK,

    Please check if the solution in the following link works for you:

    Not able to read actual auto numbers of word document using OpenXML

    Please feel free to ask any questions. Looking forward to hearing from you.

    Best Regards,

    Yuki


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Wednesday, September 5, 2018 10:26 AM
    Moderator
  • Hi,

    The document do not have lvlRestart property which will reset the auto numbers and also I have observed is if section break is deleted which is at starting of second page then the auto numbers will be changed and are continuous from the first page. Is the section break causing the issue if so how to reset the auto numbers aftersection breaks ? 


    Friday, September 7, 2018 6:55 AM
  • Hi,

    One more observation is the document numbering.xml file dont have any w:lvlstart property and auto numbers are of multilevel list pattern.

    Thanks,

    Gayatri

    Monday, September 10, 2018 1:51 PM
  • Hi Gayatrik,

    Sorry for late reply.

    >> Is the section break causing the issue if so how to reset the auto numbers after section breaks?

    If your text runs inside your WordProcessingML, whether or not you have tweaked the numbering styles.

    You can always start a new section with new numbering by just spelling it out that way in the XML:

    <w:listPr>
                <w:ilvl w:val="0" />
                <w:ilfo w:val="1" />
                <wx:t wx:val="2." wx:wTabBefore="360" wx:wTabAfter="195" />
                <wx:font wx:val="Times New Roman" />
              </w:listPr>
            </w:pPr>
            <w:r>
              <w:t>Two</w:t>
            </w:r>
          </w:p>
          <w:p>
            <w:pPr>
              <w:listPr>
                <w:ilvl w:val="0" />
                <w:ilfo w:val="2" />
                <wx:t wx:val="1." wx:wTabBefore="360" wx:wTabAfter="195" />
                <wx:font wx:val="Times New Roman" />
              </w:listPr>
            </w:pPr>
            <w:r>
              <w:t>One</w:t>
            </w:r>
          </w:p>
          <w:p>
            <w:pPr>
              <w:listPr>
                <w:ilvl w:val="0" />
                <w:ilfo w:val="2" />
                <wx:t wx:val="2." wx:wTabBefore="360" wx:wTabAfter="195" />
                <wx:font wx:val="Times New Roman" />
              </w:listPr>
            </w:pPr>
            <w:r>
              <w:t>Two</w:t>
            </w:r>
          </w:p>
          <w:p />

    For more information, please review the following link:

    WordProcessingML and Numbered Lists Restarting

    >> The document numbering.xml file don't have any w:lvlstart property and auto numbers are of multilevel list pattern.

    For this question, Please review the following link:

    Processing the w:lvlRestart Element

    Defining a Particular Level - Restart Numbering

    Hopefully it helps you. Looking forward to hearing from you.

    Best Regards,

    Yuki


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.



    Wednesday, September 12, 2018 9:27 AM
    Moderator
  • Hi GayatriK,

    Thanks for your asking. Did you resolve your issue ? If the post helps you, you can mark it as answer and close the post.

    Thank you for understanding. If you have any question, or update, please feel free to let us know.

    I wish you a happy life!

    Best Regards,

    Yuki


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Tuesday, September 18, 2018 5:03 AM
    Moderator
  • Hi,

    The document numbering.xml file don't have any w:lvlstart property but it has multilevel list pattern and auto numbers are resetting after section break(of type continous) if section break is deleted auto numbers are continuous followed by the previous page. so i need logic to reset auto numbers in document after section break if auto numbers are part of multilevel list numbers.

    Thanks,

    Gayatri  

    Friday, September 21, 2018 10:32 AM
  • Hi GayatriK,

    Sorry for the late reply.

    >> The document numbering.xml file don't have any w:lvlstart property but it has multilevel list pattern.

    A list template defines a numbering scheme, including the form of number to be used and the tabs and indents for the numbered paragraphs.

    List templates can be multi-level or single-level. When a paragraph style is numbered or bulleted, the style is linked to a level of a list template.

    >> so i need logic to reset auto numbers in document after section break if auto numbers are part of multilevel list numbers.

    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:

                    <w:numPr>
                        <w:ilvl w:val="0"/>
                        <w:numId w:val="1"/>
                    </w:numPr>

    Also there are a number of different ways you can force the numbering to restart which has mentioned in the following link:

    How to restart style-based numbering

    Hopefully it helps you. Please feel free to ask any questions.

    Best Regards,

    Yuki


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Wednesday, September 26, 2018 9:37 AM
    Moderator
  • Thank you so much MSDN Community Support
    Wednesday, September 26, 2018 9:39 AM
  • Hi GayatriK,

    Thanks for your asking. Did you resolve your issue? If the post helps you, you can mark it as answer and close the post.

    Thank you for understanding. If you have any question, or update, please feel free to let us know.

    I wish you a happy life!

    Best Regards,

    Yuki

    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Friday, September 28, 2018 7:05 AM
    Moderator