This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
WP New style sheet
|
WP New style sheet ( wpDoc ; styleSheetType ; styleSheetName ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
wpDoc | Object |
![]() |
4D Write Pro document | |||||
styleSheetType | Longint |
![]() |
Type of style sheet | |||||
styleSheetName | String |
![]() |
Name of style sheet | |||||
Function result | Object |
![]() |
Style sheet object | |||||
The WP New style sheet command creates a new (empty) style sheet object for the designated wpDoc.
In the wpDoc parameter, pass a 4D Write Pro document.
The styleSheetType parameter lets you designate the type of the style sheet, i.e. the part of the wpDoc that will be affected by the style sheet. Two types are available:
Pass a name for the style sheet in the styleSheetName parameter. The style sheet's name is stored with the document and facilitates reusing or modifying the style. It can also be used with the WP Get style sheet and WP DELETE STYLE SHEET commands. The style sheet name must comply with the following rules:
You can specify the attributes of the style sheet using the WP SET ATTRIBUTES command or the object notation (see 4D Write Pro Attributes). For the list of available attributes, see the Style sheet attributes section.
Notes:
The following code creates and defines a paragraph style sheet:
C_OBJECT($styleSheet)
$styleSheet:=WP New style sheet(wpArea;wk type paragraph;"Main title")
//define style sheet settings
WP SET ATTRIBUTES($styleSheet;wk font family;"Papyrus")
WP SET ATTRIBUTES($styleSheet;wk font size;"48pt")
WP SET ATTRIBUTES($styleSheet;wk text color;"red")
WP SET ATTRIBUTES($styleSheet;wk text align;wk left)
//Apply the style sheet to the first paragraph
C_COLLECTION($Paragraphs)
$Paragraphs:=WP Get elements(wpArea;wk type paragraph)
If($Paragraphs.length>0)
WP SET ATTRIBUTES($Paragraphs[0];wk style sheet;$styleSheet)
End if
Accessing document contents by programming
WP DELETE STYLE SHEET
WP Get style sheet
WP Get style sheets
WP IMPORT STYLE SHEETS
Product: 4D
Theme: 4D Write Pro Language
Number:
1650
Created: 4D v18
4D Write Pro Reference ( 4D v20 R7)