none
Create and Get a Paragraph RRS feed

  • Question

  • Hello,

    Here is my code :

    Range firstRange = start;
    firstRange.Start = firstRange.End;         
    Paragraph p = Paragraphs.Add(firstRange);

    p.Range.Text = "Level1\r"; p.Indent();


    The indent is not working as the range of the Paragraph is the range of the "\r" character.

    How may I retrieve the Paragraph p meaning the complete "Level1\r"

    Thanks for the help

    Linvi

    Wednesday, March 27, 2013 6:38 PM

Answers

  • Hi Linvi

    You don't show us what the object start is or how it was defined. that makes it difficult to check, but...

    Simply don't add an additional paragraph (that's what \r does) at the same time you assign the text. OR put p.Indent() before p.Range.Text


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by linvỉ Thursday, March 28, 2013 12:12 PM
    Thursday, March 28, 2013 11:36 AM
    Moderator

All replies

  • Hi Linvi

    You don't show us what the object start is or how it was defined. that makes it difficult to check, but...

    Simply don't add an additional paragraph (that's what \r does) at the same time you assign the text. OR put p.Indent() before p.Range.Text


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by linvỉ Thursday, March 28, 2013 12:12 PM
    Thursday, March 28, 2013 11:36 AM
    Moderator
  • Thank you for your help.
    Thursday, March 28, 2013 12:18 PM