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

After adding table via Code behind is not reflected to RadDocument ?

1 Answer 52 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Sopan
Top achievements
Rank 1
Sopan asked on 28 Aug 2013, 09:08 AM
Hi,

I have tried for dynamically add table to the RadDocument on RadDocumentDoubleClickEvent written in code behind file then also table is not reflected to the RadDocument. When I scrolled RadDocment then it reflected, how to add the dynamically table or any inline in element to RadDocument ?.

for reference my code is here
editor.Document.CaretPosition.MoveToPreviousInline();
var currpara = editor.Document.CaretPosition.GetCurrentParagraphBox().AssociatedParagraph;
var atable=ExpandedColl.Where(x=>x.Key==spanbox.Tag).FirstOrDefault().Value;
if(atable!=null)
{
  currsect.Blocks.AddAfter(currpara, atable);
}

1 Answer, 1 is accepted

Sort by
0
Anna
Telerik team
answered on 30 Aug 2013, 03:34 PM
Hello Sopan,

Judging by your code it seems you might be trying to use the AddAfter() method on an already measured document (one that has already been visualized in the RadRichtextBox). This may cause various issues so it is not recommended.

The recommended approach is to use the InsertTable() method of RadRichTextBox (or RadDocumentEditor in case you are not actually showing the document to the user) instead.

Of course, if you have any concerns or meet any difficulties implementing this approach, please, don't hesitate to get back to us.

Regards,
Anna
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
RichTextBox
Asked by
Sopan
Top achievements
Rank 1
Answers by
Anna
Telerik team
Share this question
or