Hello!
I decided to post on your forum as I’m having problems with using the COM variant of Aspose.Cells version 4.4.0.21 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
or
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.Open
objStream.Position = 0
objStream.Write data
objStream.SetEOS
objStream.Position = 0
objXLS.Open_3 objStream
objStream.Close
Set objStream = Nothing
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?
Hi,
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: http://www.aspose.com/docs/display/cellsnet/Accessing+Component+from+COM+Clients
the order in which method overloads are shown in the API documentation corresponds to the way they are numbered in the COM Interop.
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!
Hi,
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:
Thank you.