none
ListLevel? ListNumber?

    Question

  • Hi guys,

    I am using interop to read an MS Word document.

    The text of the document is numbered, like

    1 Title

    1.1 sub title A

    1.1.1 Sub title B

    How can I get the number ("1") of each paragraph?

    I tried with:

    // Get paragraph style.  
    Style paragraphStyle = (Word.Style)oRange.get_Style();  
    int number = paragraphStyle.ListLevelNumber;  
     

    but I don't get what I need.

    Thanks in advance,

    Aldo.


    Everything is possible, impossible just takes longer
    Thursday, January 29, 2009 2:56 PM

Answers

  • Try the ListString property. Which returns a string, BTW, not an integer.

    I'm also not sure I'd use the ranges Style for this, if you want the information for that range, specifically. More:

        string paraOutlineNumber = oRange.ListFormat.ListString;


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by ajliaks Friday, January 30, 2009 9:39 AM
    Friday, January 30, 2009 9:02 AM

All replies

  • Try the ListString property. Which returns a string, BTW, not an integer.

    I'm also not sure I'd use the ranges Style for this, if you want the information for that range, specifically. More:

        string paraOutlineNumber = oRange.ListFormat.ListString;


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by ajliaks Friday, January 30, 2009 9:39 AM
    Friday, January 30, 2009 9:02 AM
  • Exacly what I was looking for.

    Thanks a lot.


    Everything is possible, impossible just takes longer
    Friday, January 30, 2009 9:39 AM
  • this is my looking for also, thanks Cindy, you know everything.
    Sunday, December 22, 2013 8:56 AM