Inserting RadGridView into RadDocument

7 posts, 0 answers
  1. Felipe
    Felipe avatar
    1 posts
    Member since:
    Oct 2010

    Posted 26 Nov 2010 Link to this post

    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.
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 30 Nov 2010 Link to this post

    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
  3. Angeli
    Angeli avatar
    29 posts
    Member since:
    Apr 2011

    Posted 12 May 2011 Link to this post

    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?
  4. Angeli
    Angeli avatar
    29 posts
    Member since:
    Apr 2011

    Posted 12 May 2011 Link to this post


  5. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 13 May 2011 Link to this post

    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
  6. Angeli
    Angeli avatar
    29 posts
    Member since:
    Apr 2011

    Posted 18 May 2011 Link to this post

    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?
  7. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 24 May 2011 Link to this post

    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
Back to Top