Build 2.9.0.48 of xlsgen adds a couple helpers for the VBScript language. These are necessary because the VBScript language does not lend itself too much to data manipulations. A new
helpers interface is available. Particularly these are useful for wrapping ILockBytes in VARIANTs (VBScript's native data type) and vice versa.
Here is a code sample :
' xlsgen_clientside_read.vbs ' to run this code, double-click on the .vbs file ' ' demonstrates how to update an existing .xls file in memory using VBScript ' for the purpose of the sample, the output buffer is written back to a file Dim szProcessingFolder
szProcessingFolder = "c:\"
Dim engine
Set engine = CreateObject("ExcelGenerator.ARsTdesign")
' create a memory buffer host Dim lb
lb = engine.helpers.ILockBytes_New
' open an existing Excel file, and retrieve a workbook Dim wbk
Set wbk = engine.OpenInMemory(szProcessingFolder & "input.xls", lb, 3)
' create a new worksheet Dim wksht
Set wksht = wbk.AddWorksheet("sheet1")
' sample code wksht.Label(9,1) = "hello world!"
' your code begins here ' ... wbk.Close
' convert the output to a regular memory buffer (byte array) Dim byteArrayBuffer
byteArrayBuffer = engine.helpers.ILockBytes_Write(lb)
' for the purpose of the sample, write back to a regular file engine.helpers.WriteFile szProcessingFolder & "myfile.xls", byteArrayBuffer
' free the memory Set engine = Nothing