This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
WP Get breaks

WP Get breaks 


 

WP Get breaks ( targetObj {; breakType} ) -> Function result 
Parameter Type   Description
targetObj  Object in Range or element or 4D Write Pro document
breakType  Longint in Type of breaks to return
Function result  Collection in 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:

  • 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:

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:

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

 
PROPERTIES 

Product: 4D
Theme: 4D Write Pro Language
Number: 1768

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v19
Modified: 4D v19 R3

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v20 R7)