Sample source code below will show you how to cope with a difficult task like generate XLS spreadsheet in ASP Classic. ByteScout Spreadsheet SDK is the SDK that can write and read, modify and calculate Excel and CSV spreadsheets. Most popular formulas are supported. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays. It can generate XLS spreadsheet in ASP Classic.
This rich sample source code in ASP Classic for ByteScout Spreadsheet SDK includes the number of functions and options you should do calling the API to generate XLS spreadsheet. This ASP Classic sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Further enhancement of the code will make it more vigorous.
Trial version of ByteScout Spreadsheet SDK can be downloaded for free from our website. It also includes source code samples for ASP Classic and other programming languages.
<% ' In case of "Server.CreateObject Failed", "Server object error "ASP 0177 : 8000ffff" or similar errors: ' Please try the following: ' - Open IIS ' - Find application pools (DefaultAppPool is used by default) ' - Open its properties and check .NET CLR version selected: ' - if you have .NET 1.1 then change to .NET CLR 2.00 ' - if you have .NET CLR 2.00 then try to change to .NET CLR 4.0 Set document = Server.CreateObject("Bytescout.Spreadsheet.Spreadsheet") ' Add new worksheet Set worksheet = document.Workbook.Worksheets.Add("HelloWorld") ' Get cell value Set cell = worksheet.Item(0,0) ' You can also use worksheet.Cell("A1") as well ' Set cell value cell.Value = "Hello, World!" ' Generate and get XLS document as an array of bytes XLSDocumentArray = document.GetAsBytesArrayXLS response.ContentType = "vnd.ms-excel" ' Add content type header response.AddHeader "Content-Type", "application/vnd.ms-excel" ' Set the content disposition response.AddHeader "Content-Disposition", "inline;filename=HelloWorld.xls" ' Write the binary image to the Response output stream response.BinaryWrite XLSDocumentArray response.End ' Release library Set document = Nothing %>