Command WR Create stylesheet

4D Write

WR Create stylesheet

version 6.5


WR Create stylesheet (area; name{; applyTo{; shortCut}}) Longint

ParameterTypeDescription
areaLongint4D Write area
nameStringStylesheet name
applyToLongint0=characters
1=paragraphs
shortCutStringOne character

Function result Longint Stylesheet reference number

Description

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:

Constants (value)Description
wr apply to characters (0)The style sheet will be a character stylesheet
wr apply to paragraphs (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)

See Also

WR APPLY STYLESHEET, WR DELETE STYLESHEET, WR UPDATE STYLESHEET.