WP Get style sheet
WP Get style sheet ( wpDoc : Object ; styleSheetName : Text {; listLevelIndex : Integer } ) : Object
| Parámetros | Tipo | Descripción | |
|---|---|---|---|
| wpDoc | Object | → | Documento 4D Write Pro |
| styleSheetName | Text | → | Style sheet name |
| listLevelIndex | Integer | → | Level of the style sheet in the hierarchy |
| Resultado | Object | ← | Objeto hoja de estilo |
Historia
| Lanzamiento | Modificaciones |
|---|---|
| 4D 18 | Created |
| 4D 21 R3 | listLevelIndex parameter added |
Descripción
The WP Get style sheet command returns the style sheet object designated by the styleSheetName or by the style sheet name and the listLevelIndex in the case of a hierarchical list style sheet.
In wpDoc, pass the 4D Write Pro document that contains the style sheet.
The styleSheetName parameter allows you to specify the name of the style sheet to return. If the style sheet name does not exist in wpDoc, an null object is returned.
If the style sheet is part of a hierarchical list style sheet, you can optionally specify the listLevelIndex parameter to retrieve a specific level of the hierarchy.
- listLevelIndex represents the level of the style sheet in the hierarchy (1 = root level, 2 = first sub-level, etc.).
- If the parameter is omitted and the style sheet is hierarchical, the root-level style sheet is returned.
- If the requested level does not exist, a null object is returned.
- If the style sheet is not a hierarchical list style sheet and listLevelIndex is greater than 1, a null object is returned.
Ejemplo 1
To retrieve the "Main title" style sheet:
var $styleSheet : Object
$styleSheet:=WP Get style sheet(wpArea;"Main title")
If($styleSheet=Null) // check if the style sheet exists//if not create it
$styleSheet:=WP New style sheet(wpArea;wk type paragraph;"Main title")
End if
Ejemplo 2
To retrieve a specific level of a hierarchical list style sheet:
var $rootStyle : Object
var $subLevelStyle : Object
// Retrieve root-level style sheet
$rootStyle:=WP Get style sheet(wpArea;"MainList")
// Retrieve second level (first sub-level)
$subLevelStyle:=WP Get style sheet(wpArea;"MainList";2)
If($subLevelStyle=Null)
ALERT("Requested level does not exist.")
End if
Ver también
Style sheets
WP DELETE STYLE SHEET
WP Get style sheets
WP IMPORT STYLE SHEETS
WP New style sheet