Free Support Forum -

Error calling Excel.Open() with stream

I've created an Excel file using the component but when I upload it through an HTML file control and pass the resulting HttpInputStream (from File1.PostedFile.InputStream) to the Open() method on postback, I get a cast error - "Specified cast is not valid" pointing to my Open() call and referencing Asponse.Excel.Excel.Open(Stream stream) +106.

I've searched these forums plus the help and found nothing. Am I missing something? My guess is that it does not like some of the data but surely that would give a better message than this?

OEM license purchase imminent once I get past this proof of concept.

Thanks in advance.

Seeing no replies I was thinking it's either a complex problem or an obvious mistake by me! And yes, it's the latter. I see that not any old System.IO.Stream is supported, only Memory and File.

Might be nice if a quick type check threw up a better error for us newbies!

Actually Aspose.Excel can open any stream which support seekings.

We will add more information for this issue.Thanks for your suggestion.