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

System.OutOfMemoryException in RadDocument

3 Answers 104 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Sergio
Top achievements
Rank 1
Sergio asked on 26 Apr 2012, 06:23 PM
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

3 Answers, 1 is accepted

Sort by
0
Alex
Telerik team
answered on 01 May 2012, 01:13 PM
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 >>

0
Sergio
Top achievements
Rank 1
answered on 24 May 2012, 02:06 PM
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!!

0
Iva Toteva
Telerik team
answered on 30 May 2012, 01:58 PM
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 >>

Tags
RichTextBox
Asked by
Sergio
Top achievements
Rank 1
Answers by
Alex
Telerik team
Sergio
Top achievements
Rank 1
Iva Toteva
Telerik team
Share this question
or