InsertTable() problem

6 posts, 0 answers
  1. Emil Alexiev
    Emil Alexiev avatar
    8 posts
    Member since:
    Dec 2009

    Posted 19 May 2011 Link to this post

    I have an existing document and I'm trying to insert a table to the beginning of this document.  The insert works but there's always a gap between the table and the top of the document.

    Here's my code:

                Telerik.Windows.Documents.Model.Table table = new Telerik.Windows.Documents.Model.Table();
                table.Rows.Add(CreateHeadingRow("Ultrasonix Medical Corp."));
                richeditReport.Document.CaretPosition.MoveToFirstPositionInDocument();
                richeditReport.InsertTable(table);

    CreateHeadingRow() just returns a TableRow.

    Attached is an image which shows the gray table with a single row and right above it is a gap which is only added after I call InsertTable().  Can you guys help me out with this?
  2. Emil Alexiev
    Emil Alexiev avatar
    8 posts
    Member since:
    Dec 2009

    Posted 19 May 2011 Link to this post

    I wanted to attach a screenshot of the report without the call to InsertTable().  
  3. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 20 May 2011 Link to this post

    Hello Emil Alexiev,

    Currently on adding a table to the document, a paragraph is inserted before the table. This additional paragraph is needed, so that the table can be properly cut and deleted.
    In the future, this logic will probably be revised and this additional paragraph will not be needed. However, in the current version of the control, you should not remove it.

    Greetings,
    Iva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Emil Alexiev
    Emil Alexiev avatar
    8 posts
    Member since:
    Dec 2009

    Posted 20 May 2011 Link to this post

    Is there any way to do the insert without this paragraph, or is there any way to programatically remove it after InsertTable().  My document is read only and would never be changed after this so I dont care about being able to cut the table out but I need the table to be at the top of the document.
    Anything I can do to remove this paragraph?
    Thanks, Emil.
  5. Emil Alexiev
    Emil Alexiev avatar
    8 posts
    Member since:
    Dec 2009

    Posted 20 May 2011 Link to this post

    I found a solution to my problem.  Here's the code:

    Telerik.Windows.Documents.Model.Table table = new Telerik.Windows.Documents.Model.Table();
    table.Rows.Add(CreateHeadingRow(e.Result.Parameter));
     
    Telerik.Windows.Documents.Model.Section section = richeditReport.Document.Sections.ElementAt(0);
    Telerik.Windows.Documents.Model.Block firstblock = section.Blocks.ElementAt(0);
     
    if (section != null && firstblock != null)
    {
        section.Blocks.AddBefore(firstblock, table);
    }


    I was also wondering when the next RadControls version is going to be released and if it's going to include headers and footers for RichTextBox?
    Thanks.
  6. Boby
    Admin
    Boby avatar
    763 posts

    Posted 24 May 2011 Link to this post

    Hello Emil Alexiev,

    The next version of RadControls for Silverlight and WPF will be available in mid July. For now, headers and footers are planned to be included in it, and as always, we'll do our best to make it available as soon as possible.

    Kind regards,
    Boby
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top