Theme:
v
SSGear Tutorial

Other pages of interest:

This page contains a quick Tutorial to get you started with SSGear.

Simplest way to try the DLL

The best way to try the DLL is to execute the SSG function with a left argument of 1:

       1 SSG''

This displays an APL form with an empty SSGear object in it. The APL form is called ff and the SSGear object ff.ss. Moreover ⎕wself is set to 'ff.ss' so that you do not need to provide a left argument to ⎕wi to try SSGear properties and methods after having run: 1 SSG''

You could start by populating the workbook with 4 worksheets each containing a 6 by 6 matrix starting at cell b2 in each sheet:

       ⎕wi'add' 1 'b2' (?4⍴⊂6 6⍴1000)

This adds 4 6x6 APL matrices of random numbers between 1 and 1000 to the workbook populating the first sheet with the first matrix and creating 3 additional sheets, populating them with the 3 remaning matrices. All matrices are installed starting at cell b2 in all sheets.


Notice that this single instruction creates new sheets in the workbook. Also notice that the column widths are auto adjusted to the values they now contain (this behavior can be disactivated using the SkipAutoFit property).

Also note that the popupated part of the last inserted sheet is automatically selected.

Properties and methods

First, property and method names are not case sensitive. In my examples, I'll use them in all lowercase characters but it is recommended to use mixed case and also to use a

*x

prefix for properties and a

*X

prefix for methods.

In some cases this is mandatory as there could be confusion with a standard pAPL property of the same name.

Example:

      ⎕wi'version'
1.0
      ⎕wi'*xVersion'
1.0.10.0

Using just version returns the underlying APL standard version property value, while using xVersion returns the DLL Version property value.

In general, properties work on the currenctly selected range

In general, methods have 2 first arguments which are a sheet number and a range to allow working on any range in any sheet without changing the currently selected range.

So to make all the displayed numbers bold, it is as simple as this:

       ⎕wi'bold'1

Matrix properties and Scalar Extension

In the previous example, we have set the bold property by providing a single scalar. In that case, just like in APL, the provided scalar is extended to the size of the selected range and applied to all cells in the range.

But you can also provide a matrix of values matching the size of the selected range:

      ⎕wi'rangesize'       ⍝ returns the size of the currently selected range
6 6
      ⎕wi'bold'(6 6⍴4↑1)

Probably more spectacular would be:

      ⎕wi'fontsize'(6 6⍴6+⍳36)

Formatting

Here is a more complete example showing how to add formatting.

      1 SSG''

      data←?5 4⍴1000
      data←data×data≤800
      data[;¯1↑⍴data]←+/0 ¯1↓data
      data←'APL' 'C#' 'VB.Net' 'Java' 'Javascript',data
      data←('' 'Jan' 'Feb' 'Mar' 'Total')⍪data

      data
            Jan Feb Mar Total
 APL        164 281 198   643
 C#           0 790  91   881
 VB.Net     248 762 518  1528
 Java         0 333 597   930
 Javascript   0   0   0     0

      ⎕wi'add' 1 (2 2) data

Let's set column widths to 50 pixels to columns C to F and force column headers in cells C2 to F2 to be right aligned.

      ⎕wi'setcolwidths' 1 'c:f' 50  ⍝ note: scalar extension: 50 px applied to all columns in range
      ⎕wi'setalignments' 1 'c2:f2' 'right' 'center'

Let's blank all zeros

      ⎕wi'blankzeros' 1 (3 3 7 6) 1  ⍝ note: a range can be expressed in (startrow,startcol,endrow,endcol) notation

Let's change the background color of the whole table then of the row and column headings

      ⎕wi'backcolor' 255 224 224  ⍝ note: grid lines do not disappear (as they do in Excel when you set a back color)
      ⎕wi'range' 'b2:b7,b2:f2'    ⍝ note: multiple range and the list separator 
      ⎕wi'backcolor' 255 192 192
      ⎕wi'listseparator'          ⍝ note: returns the list separator to use to separate multiple ranges
,

Let's change internal and external borders (size and color)

      ⎕wi'setborders' 1 '' 'thin' (255 0 0) 'thick' (255 0 0)  ⍝ note: '' means the currently selected range
      ⎕wi'setborders' 1 'c3:f7' 'thin' (128 128 255) 'thick' (255 0 0)

Let's change the font color to blue for all cells containing a value less than 500 and let's make them bold

      ⎕wi'range' 'c3:f7'
      ⎕wi'fontcolor'(((0 0 0)(0 0 255))[1+500>1 0↓0 1↓data])
      ⎕wi'bold'(500>1 0↓0 1↓data)  ⍝ note: automatic column width AutoFit
      ⎕wi'range' 'b10'