ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Word Processing functions / Types of variables
  • Properties specific to the description of docStyle variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The docStyle type is used to define the advanced characteristics of a style belonging to a document, a paragraph or a document fragment. The characteristics of this style are returned by several WLanguage properties.
CAUTION: This type must not be used directly. It must only be used via the Document variables that contain an arry of styles associated with the document.
To associate a style with a paragraph, simply use the style identifier (StyleID property of variables of type docParagraph, docFragment and docElementText).
Example
MyDoc is Document <- WP_NoName1
// Retrieve the fragment corresponding to the current selection in the control
Frag is docFragment <- MyDoc[WP_NoName1.Cursor to WP_NoName1.CursorEnd]
 
// Apply bold formatting to the content of the fragment
Frag.Formatting.FontBold = True
// List the styles of a document
MyDocControl is Control
 
// Retrieve an associated document
MyDoc is Document = MyDocControl
 
// List all the styles used by the document
FOR EACH ADocStyle OF MyDoc.Style
Trace(ADocStyle.StyleID)
END
 
// Add the "Title1" style into a document and apply it to the selection
// The definition of "Title1" style comes from another document
MyDocControl is Control = {"MyWPControl", indControl}
 
// Retrieve an associated document
MyDoc is Document = MyDocControl
 
// if the "Title1" style does not exist, add it
// from a document containing preset styles
IF MyDoc.Style["Title1"] = Null THEN
// opens a document containing the styles
MyDocContainingTheStyles is Document = "c:\MyDocWithMyStyles.docx"
// retrieve the Title 1 style
StyleTitle1 is docStyle <- MyDocContainingTheStyles.Style["Title1"]
IF StyleTitle1 <> Null THEN
// Add the style into the document
Add(MyDoc.Style, StyleTitle1)
END
END
 
// apply the style to the selection
StyleTitle1ForSelection is docStyle <- MyDoc.Style["Title1"]
IF StyleTitle1ForSelection <> Null THEN
// create the fragment (from the selection)
f is docFragment(MyDocControl.Value, MyDocControl.Cursor, MyDocControl.SelectionLength)
// applies the Title1 style to the selection
f.StyleID = StyleTitle1ForSelection.Identifier
END
Remarks

Properties specific to the description of docStyle variables

The following properties can be used to handle a style:
Property nameType usedEffect
AliasCharacter stringDisplay name of style. This name is used if the Name property does not correspond to a display name.
If several names are available, they are separated by a comma (",").
This property is read-only.
ByDefaultBoolean
  • True if the style is the default style,
  • False otherwise.
DisplayPriorityIntegerPriority order when displaying styles in an interface (GUI). This priority order is an ascending order.
InvisibleBoolean
  • True if the style must be hidden to the user,
  • False otherwise.
If the Invisible property is set to True, this style will be reserved for internal use (e.g., parent style not available in the UI).
This property is read-only.
InvisibleIfNotUsedBoolean
  • True if the style must be hidden to the user except if it is already used in the document,
  • False otherwise.
This property is read-only.
NameCharacter stringPreset name of style or display name of style.
This property is read-only.
StyleIDCharacter stringUnique identifier of style in the document.
This property is read-only.
StyleIDLinkedCharacter stringIdentifier of linked style (Paragraph style or Character style).
If the style is a paragraph style, this property returns the identifier of the associated character type.
This property is read-only.
StyleIDParentCharacter stringIdentifier of parent style (which means on which the current style is based).
This property is read-only.
TypeInteger constantType of style:
  • docstyleCharacter: Style of characters. This style is applied to a text section.
  • docstyleNumbering: Numbering style.
  • docstyleParagraph: Paragraph style. This style is applied to an entire paragraph.
  • docstyleTable: Style of table.
This property is read-only.
Remark: the change of paragraph or fragment style automatically applies the linked paragraph style and character style if they exist.
Minimum version required
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 08/22/2022

Send a report | Local help