numbered list

2 posts, 0 answers
  1. Shahrzade
    Shahrzade avatar
    8 posts
    Member since:
    Feb 2016

    Posted 15 Apr 2016 Link to this post


    I am trying to build a RadDocument from many input RadDocuments (to put together many small documents). Many of these smaller documents have numbered lists whose numbering should be preserved. To insert each of the small documents, I am using
         richTextEditorToInsertInto.DocumentEditor.InsertFragment(new DocumentFragment(radDocumentToAppend))

    When put together in the bigger document the numbering continues to increase, e.g., if

    Document_1 contains:      and       Document_2 contains:
      DOC1_Header                               DOC2_Header
          1.  Doc1_Item1                               1.  Doc2_Item1
          2.  Doc1_Item2                               2.  Doc2_Item2
          3.  Doc2_Item3                               3.  Doc2_Item3
    When put together, the resulting document contains
          1.  Doc1_Item1
          2.  Doc1_Item2
          3.  Doc2_Item3
          4.  Doc2_Item1
          5.  Doc2_Item2
          6.  Doc2_Item3

    Is there a way of resetting the start index for list numbering to 1? How can i keep the numbering from the original documents?



  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    4086 posts

    Posted 18 Apr 2016 Link to this post

    Hello Shahrzade,

    Thank you for writing.

    Here is a sample code snippet demonstrating how to insert two numbered lists with reset start index: 
    public Form1()
        RadDocument doc1 = new RadDocument();
        Section section = new Section();
        for (int i = 1; i <= 3; i++)
            Paragraph item1 = new Paragraph();   
            Span span = new Span("Doc1_Item" + i);
        this.radRichTextEditor1.DocumentEditor.InsertFragment(new DocumentFragment(doc1));
        DocumentPosition startPosition = this.radRichTextEditor1.Document.CaretPosition; 
        DocumentPosition endPosition = new DocumentPosition(startPosition);
        ListStyle newlistStyle = new ListStyle(DefaultListStyles.Numbered);
        startPosition = this.radRichTextEditor1.Document.CaretPosition;
        startPosition = new DocumentPosition(this.radRichTextEditor1.Document.CaretPosition);
        RadDocument doc2 = new RadDocument();
        Section section2 = new Section();
        for (int i = 1; i <= 3; i++)
            Paragraph item1 = new Paragraph();   
            Span span = new Span("Doc2_Item" + i);
        this.radRichTextEditor1.DocumentEditor.InsertFragment(new DocumentFragment(doc2));
        for (int i = 0; i < doc1.Sections.First().Blocks.Count; i++)
        ListStyle listStyle = new ListStyle(DefaultListStyles.Numbered);

    I hope this information helps. Should you have further questions I would be glad to help.

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top