This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19
VP ADD STYLESHEET
|
VP ADD STYLESHEET ( vpAreaName ; styleName ; styleObj {; scope} ) | ||||||||
Parameter | Type | Description | ||||||
vpAreaName | Text |
![]() |
4D View Pro area form object name | |||||
styleName | Text |
![]() |
Name of style | |||||
styleObj | Object |
![]() |
Object defining attribute settings | |||||
scope | Longint |
![]() |
Target scope (default = current sheet) | |||||
The VP ADD STYLESHEET command creates or modifies the styleName style sheet based upon the combination of the properties specified in styleObj in the open document. If a style sheet with the same name and scope already exists in the document, this command will overwrite it with the new values.
Note: Style sheets created by this command are saved with the document.
In vpAreaName, pass the name of the 4D View Pro area. If you pass a name that does not exist, an error is returned.
The styleName parameter lets you assign a name to the style sheet. If the name is already used within the same scope, the new style sheet replaces the existing one. Note that you can use the same name for different scopes (see below).
Within the styleObj, designate the settings for the style sheet (e.g., font, text decoration, alignment, borders, etc.). For the full list of style properties, see 4D View Pro Style Objects and Style Sheets.
You can designate where to define the style sheet in the optional scope parameter using the sheet index (counting begins at 0) or with the following constants:
Constant | Value | Comment |
vk current sheet | -1 | Designates current sheet of the 4D View Pro area (default) |
vk workbook | -2 | Designates the entire workbook of the 4D View Pro area. |
If a styleName style sheet is defined at the workbook level and at a sheet level, the sheet level has priority over the workbook level when the style sheet is set.
To apply the style sheet, use the VP SET DEFAULT STYLE or VP SET CELL STYLE commands.
The following code:
$styles:=New object
$styles.backColor:="green"
//Line Border Object
$borders:=New object("color";"green";"style";vk line style medium dash dot)
$styles.borderBottom:=$borders
$styles.borderLeft:=$borders
$styles.borderRight:=$borders
$styles.borderTop:=$borders
VP ADD STYLESHEET("ViewProArea";"GreenDashDotStyle";$styles)
//To apply the style
VP SET CELL STYLE(VP Cells("ViewProArea";1;1;2;2);New object("name";"GreenDashDotStyle"))
will create and apply the following style object named GreenDashDotStyle:
{
backColor:green,
borderBottom:{color:green,style:10},
borderLeft:{color:green,style:10},
borderRight:{color:green,style:10},
borderTop:{color:green,style:10}
}
4D View Pro Style Objects and Style Sheets
VP Get stylesheet
VP Get stylesheets
VP REMOVE STYLESHEET
VP SET CELL STYLE
VP SET DEFAULT STYLE
Product: 4D
Theme: 4D View Pro Language
Number:
9753
Created: 4D v17 R6
4D View Pro Reference ( 4D v19)