Hi,
Your pasted code should work fine in a Classic ASP (and not in ASPX page) page/file. See the following sample code that works absolutely fine on ASP with BLOCKED SCRIPT
<%@ LANGUAGE = VBScript %>
<% Option Explicit %>
Aspose.Cells classical ASP sample
Aspose.Cells classical ASP sample
<%
'Create an Excel object
Dim xls
Set xls = CreateObject(“Aspose.Cells.Workbook”)
'Open a designer file (template)
xls.Open_5 “e:\test\book1.xls”
'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_3(12)
Dim cell2
Set cell2 = cells.item_3(“A2”)
cell2.PutValue_3(24)
Dim cell3
Set cell3 = cells.item_3(“A3”)
'Save the document to the stream
Dim stream
set stream = xls.SaveToStream()
Response.Clear
'Specify the document type
Response.ContentType = “application/vnd.ms-excel”
'Other options:
'Response.ContentType = “text/plain”
'Response.ContentType = “text/html”
'Specify how the document is sent to the browser.
Response.AddHeader “content-disposition”,“attachment; filename=MyBook.xls”
'Another option could be:
'Response.AddHeader “content-disposition”,“inline; 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
%>
Please save the above code to make an asp file e.g test.asp. Place the file into IIS root folder, e.g c:\inetpub\wwwroot</div>
Open the browser and paste the url and then enter:
http://localhost/test.asp
It works fine as I have tested.
Please make sure that you have registered latest version of Aspose.Cells for .NET (e.g v7.0.2) installed / registered fine. For complete reference, see the documents/articles on how to use Aspose.Cells in other programming languages:
If you need to use Aspose.Cells for .NET on ASPX page (with either C# or VB.NET
), see the featured demos for your complete reference:
Also, check the programmer’s guide documentation of the product:
Thank you.