Free Support Forum - aspose.com

Open MemoryStream Problem

hi,

we have following problem with Version 2.4.1.0. When we want Open a MemoryStream with Aspose we become the exception with unknown object.

With the version 2.3.0.0 thats done.

-hans

Hi hans,

I already found some problems in v2.4.1 and fixed it. A new hotfix will be released within one or two days.

Sorry if I’m opening a old issue again. It seems that I have the same problem with v3.0.4

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 74: System.IO.MemoryStream memoryFile = new MemoryStream(datastream); Line 75: excelFile.Open(memoryFile); Line 76: Initialize();
original code

in separate assembly I have the following code :

public void Load(byte[] datastream)
{
System.IO.MemoryStream memoryFile = new MemoryStream(datastream);
excelFile.Open(memoryFile);
Initialize();
}

And I have an upload.asp which should load the uploaded file into the Excel object
The followig is just a small piece of the code
<upload.aspx>
fileLength = uploadedFile.ContentLength;
byte[] dataStream = new byte[fileLength];
uploadedFile.InputStream.Read(dataStream,0,fileLength);
// load xls file as datastream
uploadParser.Load(dataStream);
</upload.aspx>



and I checked in debug mode, the datastream isn’t empty. I can save the object called memoryFile to a xls file again. (did that in another test.)

oeps… ignore this one.

I already found the error. Forgot to initialize the Aspose.Excel.Excel object