5.4.7 SET

The SET command is used to change the current context sheet, sheet column widths and sheet settings of the specified sheet. The type of change is specified by the OBJECT keyword's value.

SET CONTEXT

Syntax:

Command

Keyword

Value

Developer notes

SET

OBJECT

*CONTEXT

 

SHEET

value

Required. Sheet name that must exist in the document.

 

Example

SET OBJECT(*CONTEXT) SHEET(Sales)

 

SET ROW HEIGHT

Syntax:

Command

Keyword

Value

Developer notes

SET

OBJECT

*ROWHEIGHT

 

SHEET

value

Optional. A specific sheet name can be entered otherwise the current context sheet is used.

HEIGHT

integer

Optional. Height of row in twips.
If the HEIGHT keyword is missing, then -1 is used and the row height is the sheet's default row height.

RANGE

n
n,n

Range of columns. A single column number or two comma separated column numbers to specify a range of columns.

 

Example

SET OBJECT(*ROWHEIGHT) HEIGHT(300) RANGE(10)

 

SET OBJECT(*ROWHEIGHT) HEIGHT(300) RANGE(12,20)

 

SET COLUMN WIDTH

Syntax:

Command

Keyword

Value

Developer notes

SET

OBJECT

*COLUMNWIDTH

 

SHEET

value

Optional. A specific sheet name can be entered otherwise the current context sheet is used.

WIDTH

integer

Width of column.
The default value is 2560 units.

RANGE

n
n,n

Range of columns. A single column number or two comma separated column numbers to specify a range of columns.

 

Example

SET OBJECT(*COLUMNWIDTH) WIDTH(2560) RANGE(10)

 

SET OBJECT(*COLUMNWIDTH) WIDTH(2560) RANGE(12,20)

 

SET HIDE ROW

Syntax:

Command

Keyword

Value

Developer notes

SET

OBJECT

*HIDEROW

 

SHEET

value

Optional. A specific sheet name can be entered otherwise the current context sheet is used.

RANGE

n
n.n

Range of rows. A single row number or two comma separated row numbers to specify a range of rows.

 

Example

SET OBJECT(*HIDEROW) RANGE(10)

 

SET OBJECT(*HIDEROW) RANGE(20,25) SHEET(Sales)

 

SET HIDE COLUMN

Syntax:

Command

Keyword

Value

Developer notes

SET

OBJECT

*HIDECOLUMN

 

SHEET

value

Optional. A specific sheet name can be entered otherwise the current context sheet is used.

RANGE

n
n,n

Range of columns. A single column number or two comma separated numbers to specify a range of columns.

 

Example

SET OBJECT(*HIDECOLUMN) RANGE(10)

 

SET OBJECT(*HIDECOLUMN) RANGE(4,4) SHEET(Sales)

 

SET SHEET

Syntax:

Command

Keyword

Value

Developer notes

SET

OBJECT

*SHEET

All keywords are optional.

SHEET

value

Optional. A specific sheet name can be entered otherwise the current context sheet is used.

ROWHEIGHT

integer

Optional. Set the default row height in twips.

COLUMNWIDTH

integer

Optional. Set the default column width in characters.

SELECTED

*YES

Optional. Set this sheet to be the selected sheet.

*NO

 

DISPLAYGRID

*YES

Optional. Show grid.

*NO

 

PRINTGRID

*YES

Optional. Print grid.

*NO

 

PRINTAREA

value

Optional. Set print area.
Example value: $A$1:$B$2.

PRINTOFIT

*YES

Optional. Enable or disable print to fit.

*NO

 

PROTECT

*YES

Optional. Enable or disable sheet protection.

*NO

 

PASSWORD

value

Optional. The worksheet protection password is optional and is used in combination with the PROTECT keyword.

FREEZE

value

Optional. Create a split freeze pane.
Use the value of n,n to create a column split,row split freeze pane.
Use the value of n,n,n,n to create column split,row split,left most column, top row freeze pane.
Use the value of 0,0 to remove the split freeze pane.

MARGIN

value

Optional. Set sheet margins.
Component values, comma separated.
The value is top margin, bottom margin, left margin, right margin, header margin and footer margin
An empty string value is used to allow a component value to be ignored.

HEADER

*LEFT

Optional. Specify which header content to change using one of the possible values.

*RIGHT

 

*CENTER

 

FOOTER

*LEFT

Optional. Specify which footer content to change using one of the possible values.

*RIGHT

 

*CENTER

 

CONTENT

value

The header or footer content text.
Special substitution values can be used within the header and footer text. These are:
&D Date
&T Time
&P Page Number
&N Total Number of Pages
&B Bold
&U Underline
&I Italics
&S Strike Through
&E Double Underline
&X Superscript
&Y Subscript
&F Workbook Name
&AWorksheet Name
&"font name" Font Name
&nn Font Size (Must be a two-digit number. 01 to 99)
&NL New Line

 

Example

SET OBJECT(*SHEET) PRINTAREA($E$5:$F$9)

 

SET OBJECT(*SHEET) ROWHEIGHT(800) COLUMNWIDTH(80)

 

SET OBJECT(*SHEET) HEADER(*RIGHT) CONTENT(&P+1 of &N)

 

SET OBJECT(*SHEET) HEADER(*LEFT) CONTENT(Hello at &D &T from&NL the excel service)

 

SET OBJECT(*SHEET) FOOTER(*RIGHT) CONTENT(&"Courier New"&12A message)