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

Inserting RadGridView into RadDocument

6 Answers 156 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Felipe
Top achievements
Rank 1
Felipe asked on 26 Nov 2010, 08:57 PM
Hi, I'm looking for the way  to insert a RadGridView into a RadDocument as a table. I've tried to export the gridview to html and insert it (making a selection)  into my document but it does not keep the style (as a table). it only paste the text of the table. Thanks.

6 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 30 Nov 2010, 08:42 AM
Hi Felipe,

The InlineUIContainers are exported as comments in XAML format. You can handle the InlineUIContainerExporting event of htmlFormatProvider.ExportSettings and process the Xaml in the comment to create the Html content you want to show in the place of the RadGridView (or any other UIElement you wish to have in RadRichTextBox). Additionally, in the next minor release, you'll be able to access the InlineUIContainer being serialized directly from the EventArgs.
The code you need to have in order to achieve that is:

private void exportButton_Click(object sender, RoutedEventArgs e)
{
    HtmlFormatProvider provider = new HtmlFormatProvider();
    provider.ExportSettings = new HtmlExportSettings();
    provider.ExportSettings.InlineUIContainerExporting += new System.EventHandler<InlineUIContainerExportingEventArgs>(ExportSettings_InlineUIContainerExporting);
    string result = provider.Export(this.radRichTextBox.Document);
}
 
void ExportSettings_InlineUIContainerExporting(object sender, InlineUIContainerExportingEventArgs e)
{
    string xamlContent = e.CommentContent;
    // implement your logic and set e.HtmlContent
}

If you have any other questions, do not hesitate to contact us again.

Kind regards,
Iva
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Angeli
Top achievements
Rank 1
answered on 12 May 2011, 12:54 PM
hi Iva! I'm doing a similar thing as Felipe's but i seem to have trouble exporting the RadGridView's output when exported to HTML. The HTML won't seem to load in the RadRichTextBox. I'm guessing this is because it doesn't have the complete HTML tags (exporting the grid to HTML produces only the <table> tags)? i tried exporting another HTML file that starts with "<!DOCTYPE..." and there seems to be no problem. How can i attach maybe those tags when exporting the RadGridView to HTML?
0
Angeli
Top achievements
Rank 1
answered on 12 May 2011, 06:12 PM

0
Iva Toteva
Telerik team
answered on 13 May 2011, 04:23 PM
Hi Angeli,

I believe we found the answer to why your HTML file was not imported in RadRichTextBox.
You can refer to this forum thread where you have posted your HTML.

Kind regards,
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
Angeli
Top achievements
Rank 1
answered on 18 May 2011, 07:18 AM
Hi Iva! Sorry to bother you again. I'm just wondering..  You said in this forum thread : "We have adjusted our import, so that if no measurement unit is appointed, pixels are inferred.."
Do you mean that radrichtextbox already supports that import (those without px indicated)? I tried the online example but it says Unsupported File Format when I imported.
It sort of a hassle to decode the exported string from the RadGridView and put "px" on all the widths.. can you suggest another method so that i can view my exported grid?
0
Iva Toteva
Telerik team
answered on 24 May 2011, 10:01 AM
Hello Angeli,

What I meant was that we have adjusted the import in our development version and the exported grid view will be properly imported when we release an internal build or in the Q2 Beta (mid-June) at latest.
With the current version of the control, you must add the "px". You can do that by opening the HTML string with XDocument and modifying it before the import (as it is valid XHTML).
You can perform this type of modification for all properties that require it. 

All the best,
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 theTelerik Public Issue Tracking system and vote to affect the priority of the items
Tags
RichTextBox
Asked by
Felipe
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Angeli
Top achievements
Rank 1
Share this question
or