System.OutOfMemoryException in RadDocument

4 posts, 0 answers
  1. Sergio
    Sergio avatar
    14 posts
    Member since:
    Jun 2010

    Posted 26 Apr 2012 Link to this post

    Hi Telerik Team,

    Im getting the execption: System.OutOfMemoryException in RadDocument with a huge string!!!

    1)string text = sb.ToString();
    2)RadDocument doc = new XamlFormatProvider().Import(text);
    3)this.radRichTextBox.Document = doc;

    My text is a table, something like this:

    .....
        <t:Table GridColumnWidthsSerializationInfo="" LayoutMode="AutoFit" PreferredWidth="Auto" StyleName="TableGrid" TableIndent="0">
            <t:TableRow>
                <t:TableCell ColumnSpan="1" RowSpan="1">
                    ...
                </t:TableCell>
            </t:TableRow>
             
            ..........
             
             
        </t:Table>
     
     
    ....



    It always works, but now i have 20.000 rows in my table, and it crashes in : RadDocument doc = new XamlFormatProvider().Import(text) --> System.OutOfMemoryException


    Any ideas how to workaround this limitation?


    Thanks!!

    DLL Version: 2012.1.326.1050
  2. Alex
    Admin
    Alex avatar
    129 posts

    Posted 01 May 2012 Link to this post

    Hi,

    Working with tables that big is out of the scope of the RadRichTextBox control. If you share more details about your scenario we can suggest alternative approach. May be you can use the RadGridView control if it fits your needs.

    Regards,
    Alex
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Sergio
    Sergio avatar
    14 posts
    Member since:
    Jun 2010

    Posted 24 May 2012 Link to this post

    Hi Telerik Team,

    I tried with RadGridView but i still have the same problem.

    My code:
    private RadDocument CreateDocumentWithRadGridView()
    {
     
        RadGridView gridView = new RadGridView()
        {
            ItemsSource = this.Model.currentGrid.ItemsSource
        };
     
     
        Paragraph paragraph = new Paragraph();
        paragraph.Inlines.Add(new InlineUIContainer(gridView, new System.Windows.Size(gridView.ActualWidth, gridView.ActualHeight)));
     
        Section section = new Section();
        section.Blocks.Add(paragraph);
     
        RadDocument document = new RadDocument();
        document.Sections.Add(section);
     
        document.MeasureAndArrangeInDefaultSize();
        return document;
    }


    It it possible to create a RadDocument from a wcf project ? 

    Thanks!!

  5. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 30 May 2012 Link to this post

    Hi Tiago,

    What Alex meant was that you could try using RadGridView to preview the data instead of RadRichTextBox. RadGridView is better-suited for such a scenario, not only because it has the tabular look that you seem to after, but also because of its data processing abilities. The focus of RadRichTextBox, on the other hand, is on editing rich text documents, and large tables, as well as embedding complex UIElements in InlineUIContainers, is not recommended.

    Kind regards,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top