This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v19
VP SET SHEET OPTIONS

VP SET SHEET OPTIONS 


 

VP SET SHEET OPTIONS ( vpAreaName ; sheetOptions {; sheet} ) 
Parameter Type   Description
vpAreaName  String in 4D View Pro area name
sheetOptions  Object in Sheet option(s) to set
sheet  Longint in Sheet index (current sheet if omitted)

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 4D View Pro Sheet Options

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: 

Constant Value Comment
vk current sheet -1 Designates current sheet of the 4D View Pro area (default)

 

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

  // Activate protection on the current sheet
 C_OBJECT($options)
 $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))

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

 C_OBJECT($options)
 $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)

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

 C_OBJECT($options)
 $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:

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

 C_OBJECT($options)
 $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)

Here is the result:



See also 

4D View Pro Sheet Options
VP Get sheet options

 
PROPERTIES 

Product: 4D
Theme: 4D View Pro Language
Number: 9956

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v18 R3

 
ARTICLE USAGE

4D View Pro Reference ( 4D v19)