Skip to main content
Version: 20 R7 BETA

WP Get sections

WP Get sections ( targetObj ) : Collection

ParameterTypeDescription
targetObjObjectRange or element or 4D Write Pro document
Function resultCollectionCollection of all sections found in targetObj

Description

The WP Get sections command returns a collection of all sections defined in the targetObj parameter.

In the targetObj parameter, you can pass:

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

If the range or element belongs to a header or a footer, WP Get sections returns the section to which the header or footer is attached.

For text boxes and anchored pictures, WP Get sections returns:

  • a collection containing a single section if the element is anchored to a section,
  • a collection with all sections if the element is anchored to all sections,
  • an empty collection if the element is anchored to the embedded view or to a page number.

For more information about sections, please refer to the Handling headers, footers, and sections paragraph.

Example

You want to change an attribute for the last section of the 4D Write Pro area:

 var $colSections : Collection
 $colSections:=WP Get sections(wpDoc)
 WP SET ATTRIBUTES($colSections[$colSections.length-1];wk column count;3)

See also

WP Get section