Skip to main content
Version: Next

WP Get breaks

WP Get breaks ( targetObj {; breakType} ) -> Function result

ParameterTypeDescription
targetObjObject🡒Range or element or 4D Write Pro document
breakTypeLongint🡒Type of breaks to return
Function resultCollection🡐Collection of ranges

Description

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:

  • a range, or
  • an element (table / row / paragraph / body / header / footer / section / subsection / text box), or
  • a 4D Write Pro document

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:

ConstantValueComment
wk column break3Column break: inserts a column break
wk continuous section break5Defines a continuous section break (often used to change the number of columns without starting a new page).
wk line break0Line break (in the same paragraph)
wk page break2Page break: defines a new page
wk paragraph break4Paragraph break: defines a new paragraph
wk section break1Section 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:

PropertyTypeConstantDescription
[ ].breakTypeNumberwk break typeRead-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:

  1. body
  2. first page header for section 1 (if any)
  3. first page footer for section 1 (if any)
  4. left page header for section 1 (if any)
  5. left page footer for section 1 (if any)
  6. right page header for section (if any)
  7. right page footer for section 1 (if any)
  8. main header for section 1 (if any)
  9. main footer for section 1 (if any)
  10. repeat with section 2, section 3, and so on
  11. text boxes.

An empty collection is returned if targetObj does not contain any break (or any break of the requested breakType).

Example

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

See also

WP Get elements
WP INSERT BREAK