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

Out of memory error

0 Answers 92 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
caleb
Top achievements
Rank 1
caleb asked on 15 Jun 2017, 12:55 PM

Hello there,

 

I've got a large .docx file that I'm importing into a Silverlight Telerik Rich Text Box (v.2016.2.613.1050).  the import process is generating an out of memory exception. 

 

I'm following the stream process outlined inTelerik documentation:

 

if (File.Exists(filePath))
{
   lock (FileLock)
   {
        var fs = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
        return (fs);
    }
}

 

Open in Silverlight:

rrtb.Document = new DocxFormatProvider().Import(stream);

 

Error:

 

DocxViewer.xaml.cs: RadRichTextBox_OnLoaded(object, RoutedEventArgs)|Exception of type 'System.OutOfMemoryException' was thrown. 1.2.6375.25567|   at System.IO.MemoryStream.set_Capacity(Int32 value)
   at System.IO.MemoryStream.EnsureCapacity(Int32 value)
   at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.Stream.InternalCopyTo(Stream destination, Int32 bufferSize)
   at System.IO.Stream.CopyTo(Stream destination)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxImporter.OpenStreamToPart(String packageName)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxImporter.InitIImageDocumentElementFromRelationID(IImageDocumentElement image, String imageRelationID)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.ParagraphImporter.SetImageInlineProperties(String imageRelationID, IImageDocumentElement imageInline)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.ParagraphImporter.ReadImageInlineFromDrawing()
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.ParagraphImporter.ReadImageFromDrawing()
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.ParagraphImporter.BuildInline(Style style)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.ParagraphImporter.BuildRun(Style style, Paragraph paragraph)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.ParagraphImporter.Import(Style parentStyle)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.MainDocumentImporter.BuildBody()
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.MainDocumentImporter.BuildDocument()
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.MainDocumentImporter.Import()
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxImporter.ReadXmlContentFromPackage(DocxPartImporterBase importer)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxImporter.ReadXmlContentAndRelationsFromPackage(DocxPartImporterBase importer)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxImporter.Import()
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider.Import(Stream input)
   at Telerik.Windows.Documents.FormatProviders.DocumentFormatProviderBase.Import(Byte[] input)
   at BitAssassins.ProjectXIII.CrossPlatform.Controls.DocxViewer.RadRichTextBox_OnLoaded(Object sender, RoutedEventArgs e)

 

File is 206 mg in size and generated on a MAC. 

Anyone know what the max file size that the control can import?  I can just set a high limit for it.

 

Thanks,

 

Caleb

No answers yet. Maybe you can help?

Tags
RichTextBox
Asked by
caleb
Top achievements
Rank 1
Share this question
or