Skip to main content
Version: 20 R7 BETA

VP SET SHEET OPTIONS

VP SET SHEET OPTIONS ( vpAreaName : Text; sheetOptions : Object { ; sheet : Integer} )

ParameterTypeDescription
vpAreaNameObject->4D View Pro area name
sheetOptionsObject->Sheet option(s) to set
sheetObject->Sheet index (current sheet if omitted)

Description

The VP SET SHEET OPTIONS command allows defining various sheet options of the vpAreaName area.

Pass the name of the 4D View Pro area in vpAreaName. If you pass a name that does not exist, an error is returned.

Pass an object containing definitions for the options to set in the sheetOptions parameter. To view the full list of the available options, see the Sheet Options paragraph.

In the optional sheet parameter, you can designate a specific spreadsheet (counting begins at 0). If omitted, the current spreadsheet is used by default. You can explicitly select the current spreadsheet with the following constant:

  • vk current sheet

Example 1

You want to protect all cells except the range C5:D10:

// Activate protection on the current sheet
var $options : Object

$options:=New object
$options.isProtected:=True
VP SET SHEET OPTIONS("ViewProArea";$options)

// mark cells C5:D10 as 'unlocked'
VP SET CELL STYLE(VP Cells("ViewProArea";2;4;2;6);New object("locked";False))

Example 2

You need to protect your document while your users can resize rows and columns:

var $options : Object

$options:=New object
// Activate protection
$options.isProtected:=True
$options.protectionOptions:=New object
// Allow user to resize rows
$options.protectionOptions.allowResizeRows=True;
// Allow user to resize columns
$options.protectionOptions.allowResizeColumns=True;

// Apply protection on the current sheet
VP SET SHEET OPTIONS("ViewProArea";$options)

Example 3

You want to customize the colors of your sheet tabs, frozen lines, grid lines, selection background and selection border:

var $options : Object

$options:=New object
// Customize color of Sheet 1 tab
$options.sheetTabColor:="Black"
$options.gridline:=New object("color";"Purple")
$options.selectionBackColor:="rgb(255,128,0,0.4)"
$options.selectionBorderColor:="Yellow"
$options.frozenlineColor:="Gold"

VP SET SHEET OPTIONS("ViewProArea";$options;0)

// Customize color of Sheet 2 tab
$options.sheetTabColor:="red"

VP SET SHEET OPTIONS("ViewProArea";$options;1)

// Customize color of Sheet 3 tab
$options.sheetTabColor:="blue"

VP SET SHEET OPTIONS("ViewProArea";$options;2)

Result:

Example 4

You want to hide the grid lines as well as the row and column headers.

var $options : Object

$options:=New object
$options.gridline:=New object()
$options.gridline.showVerticalGridline:=False
$options.gridline.showHorizontalGridline:=False
$options.rowHeaderVisible:=False
$options.colHeaderVisible:=False

VP SET SHEET OPTIONS("ViewProArea";$options)

Result:

See also

4D View Pro sheet options
VP Get sheet options