Skip to main content
Version: 20 R6

VP SET CELL STYLE

VP SET CELL STYLE ( rangeObj : Object ; styleObj : Object)

ParameterTypeDescription
rangeObjObject->Range object
styleObjObject->Style object

Description

The VP SET CELL STYLE command applies the style(s) defined in the styleObj to the cells defined in the rangeObj.

In rangeObj, pass a range of cells where the style will be applied. If the rangeObj contains multiple cells, the style is applied to each cell.

Borders applied with VP SET CELL STYLE will be applied to each cell of the rangeObj, as opposed to the VP SET BORDER command which applies borders to the rangeObj as a whole.

The styleObj parameter lets you pass an object containing style settings. You can use an existing style sheet or create a new style. If the styleObj contains both an existing style sheet and additional style settings, the existing style sheet is applied first, followed by the additional settings.

To remove a style and revert to the default style settings (if any), pass a NULL value:

  • giving the styleObj parameter a NULL value will remove any style settings from the rangeObj,
  • giving an attribute a NULL value will remove this specific attribute from the rangeObj.

For more information about style objects and style sheets, see the Style Objects paragraph.

Example

$style:=New object
$style.font:="8pt Arial"
$style.backColor:="Azure"
$style.foreColor:="red"
$style.hAlign:=1
$style.isVerticalText:=True
$style.borderBottom:=New object("color";"#800080";"style";vk line style thick)
$style.backgroundImage:=Null //remove a specific attribute

VP SET CELL STYLE(VP Cell("ViewProArea";1;1);$style)

See also

VP ADD STYLESHEET
VP Font to object
VP Get cell style
VP Object to font
VP SET BORDER
VP SET DEFAULT STYLE