Build 5.0.0.18 of xlsgen adds support for running Windows PowerShell scripts.
Windows PowerShell is part of Windows and is more security-aware than other scripting languages such as VBScript and JScript. Since it can create and run COM object instances, and expose the object model to the client application, it is important to make it available to everyone in the context of xlsgen applications. Windows PowerShell scripts are
.ps1 files.
And PowerShell is one of the available programming language targets available in the automatic source code generation tool that comes with the xlsgen install so you can get going in a snap.
Build 5.0.0.18 comes with a code sample (/samples/PowerShell) that creates a simple worksheet. A copy of it is below.
Note that the xlsgen object model has constants (enumerated types) that PowerShell does not expose after reading the xlsgen type-library so we are making available, also in code samples, a file called
xlsgen.ps1 that exposes all constants available from the object model.
Below is a code sample using PowerShell :
# Produced by xlsgen code generator (c) ARsT design.
# For more info, see http://xlsgen.arstdesign.com
#
# To use this code in your PowerShell script editor, remember to add the
# xlsgen constant-library with the following statement :
# .samples/PowerShell/xlsgen.ps1
#
# In order to import the .ps1 script, make sure to run PowerShell as admin and
# set the appropriate execution policy as in :
# Set-ExecutionPolicy RemoteSigned
# which allows to run the .ps1 script within a console
#
$engine = new-object -ComObject ExcelGenerator.ARsTDesign
$workbook = $engine.New( "C:\tmp\myfile.xlsx" )
$wksht001 = $workbook.AddWorksheet( "Sheet1" )
$wksht001.Cell(1,2).HtmlFloat = "<font color=#000000 size=11 name=""Calibri"">154</font>"
$wksht001.Cell(1,3).HtmlLabel = "<font color=#000000 size=11 name=""Calibri"">this is a test</font>"
$wksht001.Cell(3,3).HtmlFloat = "<font color=#000000 size=11 name=""Calibri"">1</font>"
$wksht001.Cell(4,3).HtmlFloat = "<font color=#000000 size=11 name=""Calibri"">2</font>"
$workbook.Close()