WP DELETE STYLE SHEET
WP DELETE STYLE SHEET ( styleSheetObj : Object )
WP DELETE STYLE SHEET (wpDoc : Object ; styleSheetName : Text {; listLevelIndex : Integer })
| Parameter | Type | Description | |
|---|---|---|---|
| styleSheetObj | Object | → | Style sheet object |
| wpDoc | Object | → | 4D Write Pro document |
| listLevelIndex | Integer | → | Level of the style sheet in the hierarchy |
| styleSheetName | Text | → | Name of style sheet |
History
| Release | Changes |
|---|---|
| 4D 18 | Created |
| 4D 21 R3 | listLevelIndex parameter added |
Description
The WP DELETE STYLE SHEET command removes the designated paragraph or character style sheet from the current document. When a style sheet is removed, every character or paragraph that it was applied to reverts to its original style (i.e. the default).
This command provides two ways to remove a style sheet. You can specify:
- the style sheet object (created with the WP New style sheet or returned by the WP Get style sheet command) to remove in the styleSheetType parameter, or
- the 4D Write Pro document along with the name of the style sheet to remove in the wpDoc and styleSheetName parameters.
When the style sheet to delete belongs to a hierarchical list style sheet, the behavior depends on the level being removed. You can delete:
- the root-level style sheet, or
- a specific sub-level style sheet by providing the optional listLevelIndex parameter.
When you delete the root-level style sheet (by passing 1 in the listLevelIndex parameter or ommitting it), all associated sub-level style sheets are deleted automatically and the entire hierarchical structure is removed from the document.
When you delete a sub-level style sheet:
- The
wk list level indexof all subsequent sub-level style sheets is decremented to maintain continuous level numbering. - The names of the affected sub-level style sheets are updated to reflect their new level index.
- The
wk list level countattribute of the root style sheet and all remaining sub-level style sheets is decremented to match the new total number of levels.
The command performs no action if the specified level does not exist, or if the style sheet is not part of a hierarchical list and listLevelIndex is greater than 1.
Note: The default ("Normal") style sheet can not be deleted.
Example
The following example deletes the second level of a hierarchical list style sheet:
// Delete level 2 of the "MainList" hierarchical style sheet
WP DELETE STYLE SHEET(wpArea; "MainList"; 2)
After execution:
- The
wk list level indexvalues are updated (former level 3 becomes level 2). - The
wk list level countis decremented.
To delete the entire hierarchical style sheet (root and all associated sub-levels):
WP DELETE STYLE SHEET(wpArea; "MainList")
See also
Style sheets
WP Get style sheet
WP Get style sheets
WP IMPORT STYLE SHEETS
WP New style sheet