statement2.other.asp
<%@ LANGUAGE = VBScript %>
<% Option Explicit %>
<%
'----------------------------------------------------------------------
' statement2.asp - SpeedGen ASP Sample Script
' (c) 2000-2002 Optimized Software Ltd. All Rights Reserved.
'----------------------------------------------------------------------
' This script demonstrates:
' - Loading XML from Strings.
' - The =OFFSET Excel Function
'
' Notes:
' - Using Excel SpeedGen with XML requires MSXML 4.
' - This is not a real-world example.
' You should just use the AddRS_XML method instead of AddRS_XML_String
' when you want to load from a File or URL. Sometimes you may need
' to load XML from a String. This sample loads a file into a string and
' then loads the XML from that String. This approach was chosen for this
' sample because the XML is too long to fit into the ASP script as an
' embedded string.
' - AddRS_XML will always be faster and more memory efficient than
' AddRS_XML_String for loading XML documents from disk or URL.
'----------------------------------------------------------------------
' Tip: Code Library at http://www.excelspeedgen.com/code
'----------------------------------------------------------------------
Dim XLS ' SpeedGen Object
Dim SrcBook ' Source Workbook
Dim XML1 ' XML String 1
Dim XML2 ' XML String 2
' Load XML Files into XML1, XML2
' (See NOTE at top. This is only an example to show how to use
' AddRS_XML_String . If you want to load from a file in your scripts
' then you should use AddRS_XML instead )
Const ForReading = 1
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(Server.MapPath("statement1.xml"), ForReading)
XML1 = f.ReadAll
Set f = fso.OpenTextFile(Server.MapPath("statement2.xml"), ForReading)
XML2 = f.ReadAll
' Create Excel File
Set XLS = Server.CreateObject("XLSpeedGen.ASP")
XLS.EstimatedSize = 50000 ' Set Estimated Output File Size (Critical for speed)
XLS.AddRS_XML_String XML1 ' Add RecordSource 1
XLS.AddRS_XML_String XML2 ' Add RecordSource 2
SrcBook = Server.MapPath("statement.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
%>
This Code Sample is intended for use with Excel SpeedGen