Free Support Forum - aspose.com

Problems faced in usage of Excel in ASP application

Hi,

I am currently working with Aspose.cells and I am facing issues with the code.

Please find in the attachment the code along with the error snapshot.

Also, i have used smart markers instead of data markers, as seen in one of the threads.

Please guide.

Thanks and Regards,

Divya Dixit

Hi,

In case you aren't able to access the code snippet. please find it attached here.

The error is same as attached in the previous reply.

Regards,
Divya

Hi Divya,

Thanks for considering Aspose.

Well, the error does not seem to have much sense or relate to Aspose.Cells component. The error might relate to the code (on the .asp page) other than Aspose.Cells APIs, please check to sort it out.

Could you simply try the following code with your template file and check if it works fine.

<%
'Create an Excel object
Dim xls
Set xls = CreateObject("Aspose.Cells.Workbook")
'Open a designer file (template)
xls.Open_5 Server.MapPath(myTemplate)
'Put data into this file
Dim sheet
Set sheet = xls.worksheets.item(0)
Dim cells
Set cells = sheet.cells
Dim cell
Set cell = cells.item_3("A1")
cell.PutValue_5 "Hello World!"
'Save the document to the stream
Dim stream
set stream = xls.SaveToStream()
Response.Clear
'Specify the document type
Response.ContentType = "application/vnd.ms-excel"
'Specify how the document is sent to the browser.
Response.AddHeader "content-disposition","attachment; filename=MyBook.xls"
'Get data bytes from the stream and send it to the response.
Dim bytes
bytes = stream.ToArray()
Response.BinaryWrite(bytes)
Response.End
%>

If you still find some problems, please do post your template file here.

Thank you.