Skip to main content
Version: 20 R7 BETA

WP INSERT BREAK

WP INSERT BREAK ( targetObj ; breakType ; mode {; rangeUpdate} )

ParameterTypeDescription
targetObjObjectRange or element or 4D Write Pro document
breakTypeLongintType of break to insert
modeLongintInsertion mode
rangeUpdateLongintRange update mode

Description

The WP INSERT BREAK command inserts a new break of the breakType type in the targetObj according to the specified insertion mode and rangeUpdate parameters.

In targetObj, pass:

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

In breakType, pass one of the following constants from the 4D Write Pro Constants theme to define the type of break to insert:

ConstantTypeValueComment
wk column breakLongint3Column break: inserts a column break
wk continuous section breakLongint5Defines a continuous section break (often used to change the number of columns without starting a new page).
wk line breakLongint0Line break (in the same paragraph)
wk page breakLongint2Page break: defines a new page
wk paragraph breakLongint4Paragraph break: defines a new paragraph
wk section breakLongint1Section break: defines a new section

In the mode parameter, pass a constant to indicate the insertion mode to be used for the break in the destination targetObj:

ConstantTypeValueComment
wk appendLongint2Insert contents at end of target
wk prependLongint1Insert contents at beginning of target
wk replaceLongint0Replace target contents
  • If targetObj is a range, you can use the optional rangeUpdate parameter to pass one of the following constants to specify whether or not the inserted contents are included in the resulting range:
ConstantTypeValueComment
wk exclude from rangeLongint1Inserted contents not included in updated range
wk include in rangeLongint0Inserted contents included in updated range (default)

If you do not pass a rangeUpdate parameter, by default the inserted contents are included in the resulting range.

  • If targetObj is not a range, rangeUpdate is ignored.

Example 1

While building invoices, you want to insert page breaks except on the last page:

 $nbInvoices:=Records in selection([INVOICE])
 For($j;1;$nbInvoices)
    ... //processing invoices
    If($j#$nbInvoices) //insert page break except for last page
       WP INSERT BREAK($buildRange;wk page break;wk append;wk exclude from range)
    End if
 End for

Example 2

You want to insert a continuous section break to have a single column section and a two-column section on the same page.

  1. Insert a continuous section break at the selection to create a new section:
 $range:=WP Selection range(*;"WParea")  
 WP INSERT BREAK($range;wk continuous section break;wk append)

2. Set the column count to 2 for the first section:

 $section:=WP Get section(WParea;1)  
 WP SET ATTRIBUTES($section;wk column count;2)

See also

WP Get breaks
WP INSERT DOCUMENT