Command WR SET STYLESHEET INFO

4D Write

WR SET STYLESHEET INFO

version 6.5


WR SET STYLESHEET INFO (area; styleSheetNumber; name; applyTo; shortCut)

ParameterTypeDescription
areaLongint4D Write area
styleSheetNumberLongintStyle sheet number
nameAlphaName of the style sheet
applyToInteger0=characters
1=paragraphs
shortCutAlphaone character
"" if no shortcut

Description

The WR SET STYLESHEET INFO command allows you to modify the properties of the style sheet whose reference number is passed in styleSheetNumber and which is contained in the 4D Write document with the reference number area. The style sheet number corresponds to the order of apperance the style sheet when it is either displayed in the Style sheet drop-down list or in the list in the Style sheets dialog.

name

If name is an empty string, the original name of the style sheet will not be modified. The name of a style sheet must not exceed 31 characters.

Warning: two style sheets can both have the same name, however they will always have different reference numbers.

applyTo

If applyTo equals -1, the current value will remain the same.You can also 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

A paragraph style sheet always apply to all the paragraphs of the selection, even if the first or last paragraphs are partially selected. By default a newly created style sheet is a character style sheet.

shortCut

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.

styleSheetNumber

If you want the style sheet number to remain identical, you need to call the WR GET STYLESHEET INFO command and use the reference number returned by that command .

Example

You want to modify the definition of the "Title" style sheet: its name is changed to "Title 14", its font should be set to Times 14 with the Bold style attribute selected as well as the blue color.

   NbStyles:=WR Count (Area;12)
   For ($i;1;NbStyles)
      WR GET STYLESHEET INFO(Area;$i;$Name;$ApplyTo;$Protected;$Shortcut)
      If ($Name="Title")
         WR SET STYLESHEET INFO(Area;$i;"Title 14";$ApplyTo;$Shortcut)
         WR SET STYLESHEET FONT(Area;$i;"Times")
         WR SET STYLESHEET TEXT PROP(Area;$i;wr font size;14;1)
         WR SET STYLESHEET TEXT PROP(Area;$i;wr bold;1;1)
         WR SET STYLESHEET TEXT PROP(Area;$i;wr text color;212;1)
      End if
   End for

See Also

WR GET STYLESHEET INFO.