Opening Stream in Classic ASP


I decided to post on your forum as I’m having problems with using the COM variant of Aspose.Cells version in Classic ASP.

I have a DownloadFile function which returns XLS file data in a form of byte array. As I’ve read in the documentation Aspose should be able to read Stream data, so I’m converting the byte array into Stream. Then I tried to open it using several Open_X overrides, but all of them return one of two exceptions:
Class doesn’t support Automation
Invalid procedure call or argument

Could you tell me how it should be done?

Here’s my code:

Const adoTypeBinary = 1
Dim data
data = DownloadFile(txtPath, txtFilename)

Dim objStream
Set objStream = Server.CreateObject(“ADODB.Stream”)
objStream.Type = adoTypeBinary
objStream.Position = 0
objStream.Write data
objStream.Position = 0

objXLS.Open_3 objStream

Set objStream = Nothing


Thanks for providing us some details.

I am not entirely certain if COM interop. does support streaming an Excel file properly itself. For your information, to use any custom .NET component (e.g Aspose.Cells APIs) in classic ASP is challenging and you would always need advanced technical skills. There might be lots of issues to cope with which could not be fixed. So, we recommend you should create a wrapper assembly which should wrap Aspose.Cells and expose itself as a COM object. Please research on internet how to create a .NET assembly which could expose itself as COM object. You can bundle and use all your desired features of Aspose.Cells in your classic ASP. Besides this, we also recommend some users to use Aspose.Cells for Cloud (REST based APIs). Because these APIs can be used in any platform and languages for their needs.

Well, since you are using an older version of the product and we cannot even evaluate your issue using your older version. So, kindly follow what is suggested in the above paragraph. By the way, could you test if you could open an Excel file from file path instead of streams via Aspose.Cells APIs (e.g using respective Workbook.Open_XXXX method), see the sample code below:
Sample code


'Create an Excel object
Dim xls
Set xls = CreateObject(“Aspose.Cells.Workbook”)

'Open a designer file (template)
xls.Open_5 “e:\test\book1.xls” //Get/specify your file path.

'Put data into this file
Dim sheet
Set sheet = xls.worksheets.item(0)

Dim cells
Set cells = sheet.cells

Thank you.

Thank you for your reply.

Yes, Open_5 works fine - it’s been there before my changes. We’re trying to update some legacy code to use Streams. I’ll consult with my colleagues if creating a wrapper would be a valid solution for our needs. Thank you for that suggestion.

Best regards!

One more question - is it possible for one of the Open overrides to accept a byte array if Stream is not supported?


Well, I do not think there is any Workbook.Open() overloaded method to accept byte array directly instead of streams, you got to create the streams based on your byte array by yourself.

Thank you.

Hi again!

I have talked with other guys from my team and have some more questions.

We’ve updated our Aspose.Cells version to 8.3.0 as that’s the last one which contains the Open_X overloads in the API (there are no constructor overloads in Classic ASP).

According to this document: the order in which method overloads are shown in the API documentation corresponds to the way they are numbered in the COM Interop.
Here’s the API documentation for opening files: Different Ways to Open Files|Documentation
Opening using a Stream is number 2, so I assumed that Open_2 overload would be the one I should use. However I’m still getting the Invalid procedure call or argument. We would really prefer not to go the COM wrapper way as this adds another dependency to legacy code which we want to avoid.
So is it possible at all to use an input stream with Aspose.Cells in Classic ASP?

Thank you and best regards!


Well, as I told you and I doubt if COM interop. supports streaming files effectively. Also, I am afraid, upgrading to later versions of Aspose.Cells APIs would not be of much help in your case. I think there is no better way to cope with your issue except you either create a wrapper assembly (See my previous reply here: or use file path instead of streams.

Thank you.