<%@ LANGUAGE = VBScript %> <% Option Explicit %> <% '---------------------------------------------------------------------- ' invoice.asp - SpeedGen ASP Sample Script ' (c) 2000-2002 Optimized Software Ltd. All Rights Reserved. '---------------------------------------------------------------------- ' This script demonstrates: ' - Variable Field Markers ' - Array Field Markers (1 Dimensional Arrays) ' - Merged Cells with Word Wrap to display on multiple lines ' ' Notes: ' - for 2D Arrays see the Array sample '---------------------------------------------------------------------- ' Tip: Code Library at http://www.excelspeedgen.com/code '---------------------------------------------------------------------- Dim XLS ' SpeedGen Object Dim SrcBook ' Source Workbook Dim Qty, Desc, Price ' Array Variables ' Create Excel File Set XLS = Server.CreateObject("XLSpeedGen.ASP") XLS.EstimatedSize = 50000 ' Set Estimated Output File Size (Critical for speed) ' Sold To: Address XLS.AddVariable "Address1", "British Coffee Importers" XLS.AddVariable "Address2", "80 Regent Street" XLS.AddVariable "Address3", "London, UK. W1R 6JP" XLS.AddVariable "Address4", "Phone: 020 7827 4590" ' Ship To: Address XLS.AddVariable "ShipAddress1", "Southampton Coffee" XLS.AddVariable "ShipAddress2", "402 Leeds St" XLS.AddVariable "ShipAddress3", "Southampton, UK SO14 2PF" XLS.AddVariable "ShipAddress4", "Phone: 01703 711904" ' Misc XLS.AddVariable "InvNumber", "C09243" XLS.AddVariable "InvDate", Now XLS.AddVariable "Terms", "COD" XLS.AddVariable "SalesRep", "J. Sousa" XLS.AddVariable "ShipVia", "FEDEX" XLS.AddVariable "TaxRate", 0.07 ' Goods Sold (Arrays) Qty = Array(2,8, 1) Desc = Array("Columbian Coffee (10kg) (Special one-time discount of 50%)", "Joe's Special Coffee (5kg)", "Kenyan Coffee (5kg)") Price = Array(40.22, 23.50, 30.15) XLS.AddArray "Qty", Qty XLS.AddArray "Desc", Desc XLS.AddArray "UnitPrice", Price SrcBook = Server.MapPath("invoice.xls") ' Location of Source Workbook XLS.Generate SrcBook, "", True ' Generate SpreadSheet and Stream to Client, Open in Place Set XLS = Nothing ' Destroy object when done %>