4D Write v14

WR Create stylesheet

Home

 
4D Write v14
WR Create stylesheet

WR Create stylesheet 


 

WR Create stylesheet ( area ; name ; applyTo ; shortcut ) -> Function result 
Parameter Type   Description
area  Longint in 4D Write area
name  String in Stylesheet name
applyTo  Longint in 0=characters 1=paragraphs
shortcut  String in One character
Function result  Longint in Stylesheet reference number

The WR Create stylesheet command creates a new style sheet and returns the number that was assigned to it. The features of the new style sheet are set by the parameters name, applyTo and shortCut. You can modify the style sheet by using the WR SET STYLESHEET TEXT PROP, WR SET STYLESHEET FONT, WR SET STYLESHEET TAB and the style sheet reference number.

name: the length of a style sheet name is limited to 31 characters.

In the applyTo parameter, you can pass one of the following constants, found in the WR Parameters theme:

Constant Type Value Comment
wr apply to characters Longint 0 The style sheet will be a character stylesheet
wr apply to paragraphs Longint 1 The style sheet will be a paragraph stylesheet

When applied to paragraphs, it begins with the first paragraph contained in your selection and is applied through to the end of the last paragraph of this selection. If applyTo is omitted, the style sheet will be a character style sheet.

The shortCut optional parameter allows you to assign a keyboard shortcut to the style sheet. It only accepts one character. To use the shortcut you will need to press the key passed in this parameter with the Ctrl key (on Windows) or the Command key (on Mac OS). It is recommended that you use a number in order to avoid any conflict with the standard 4D Write keyboard shortcuts.

If shortCut is omitted or if it is an empty character string no shortcut will be assigned to the style sheet.

Example  

You want to add to each document your own customized character style sheet and to apply it to the selection. The style sheet is assigned the shorctuts Command+1 on Mac OS and Ctrl+1 on Windows. The font used is Comic Sans MS 12 points.

 $NumSheet:=WR Create stylesheet(Area;"MyOwnStyle";wr apply to characters;"1")
 WR SET STYLESHEET FONT(Area;$NumSheet;"Comic Sans MS")
 WR SET STYLESHEET TEXT PROP(Area;$NumSheet;wr font size;12;1)
 WR EXECUTE COMMAND(Area;wr cmd select all)
 WR APPLY STYLESHEET(Area;$NumSheet)

 
PROPERTIES 

Product: 4D Write
Theme: WR Style Sheet
Number: 89491

 
HISTORY 

Created: 4D Write 6.5

 
SEE ALSO 

WR APPLY STYLESHEET
WR DELETE STYLESHEET
WR UPDATE STYLESHEET

 
ARTICLE USAGE

4D Write Language ( 4D Write v11.6)
4D Write Language ( 4D Write v12)
4D Write Language ( 4D Write v14)
4D Write Language ( 4D v13)
4D Write Language ( 4D Write v14 R2)
4D Write Language ( 4D Write v14 R3)
4D Write Language ( 4D Write v14 R4)