This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
WP Get breaks
|
WP Get breaks ( targetObj {; breakType} ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
targetObj | Object |
![]() |
Range or element or 4D Write Pro document | |||||
breakType | Longint |
![]() |
Type of breaks to return | |||||
Function result | Collection |
![]() |
Collection of ranges | |||||
The WP Get breaks command returns the collection of all breaks inserted in targetObj.
This command only returns breaks entered by a user or the code, and not those automatically generated by 4D Write Pro for layout purposes.
In the targetObj parameter, you can pass:
By default, breaks of any type are returned. You can select a specific break type to return by passing one of the following constants in the optional breakType parameter:
Constant | Value | Comment |
wk column break | 3 | Column break: inserts a column break |
wk continuous section break | 5 | Defines a continuous section break (often used to change the number of columns without starting a new page). |
wk line break | 0 | Line break (in the same paragraph) |
wk page break | 2 | Page break: defines a new page |
wk paragraph break | 4 | Paragraph break: defines a new paragraph |
wk section break | 1 | Section break: defines a new section |
Returned value
WP Get breaks returns a collection of range objects, each of them describing a break within the targetObj. A specific read-only property is available in each range object, providing the type of the break:
Property | Type | Constant | Description |
[ ].breakType | Number | wk break type | Read-only: type of the break |
If targetObj is a range or element, breaks are returned in the order they are found.
If targetObj is a 4D Write Pro document, breaks are returned in the following order:
An empty collection is returned if targetObj does not contain any break (or any break of the requested breakType).
You want to replace all line breaks with paragraph breaks in the document:
var $_filteredBreaks : Collection
var $break : Object
$_filteredBreaks:=WP Get breaks(WParea;wk line break)
For each($break;$_filteredBreaks)
WP INSERT BREAK($break;wk paragraph break;wk replace)
End for each
Product: 4D
Theme: 4D Write Pro Language
Number:
1768
Created: 4D v19
Modified: 4D v19 R3
4D Write Pro Reference ( 4D v20 R7)