This is a migrated thread and some comments may be shown as answers.

InsertTable() problem

5 Answers 54 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Emil Alexiev
Top achievements
Rank 1
Emil Alexiev asked on 19 May 2011, 11:14 PM
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?

5 Answers, 1 is accepted

Sort by
0
Emil Alexiev
Top achievements
Rank 1
answered on 19 May 2011, 11:16 PM
I wanted to attach a screenshot of the report without the call to InsertTable().  
0
Iva Toteva
Telerik team
answered on 20 May 2011, 02:10 PM
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
0
Emil Alexiev
Top achievements
Rank 1
answered on 20 May 2011, 06:35 PM
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.
0
Emil Alexiev
Top achievements
Rank 1
answered on 21 May 2011, 01:23 AM
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.
0
Boby
Telerik team
answered on 24 May 2011, 04:00 PM
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
Tags
RichTextBox
Asked by
Emil Alexiev
Top achievements
Rank 1
Answers by
Emil Alexiev
Top achievements
Rank 1
Iva Toteva
Telerik team
Boby
Telerik team
Share this question
or