Skip to main content
Version: 20 R7 BETA

WP Get section

WP Get section ( targetObj ) | (wpDoc ; sectionIndex ) -> Function result

ParameterTypeDescription
targetObjObjectRange or element
wpDocObject4D Write Pro document
sectionIndexLongintSection index
Function resultObject4D Write Pro section

Description

The WP Get section command returns the first section intersected by the targetObj range or element, or to the specified sectionIndex of the wpDoc document.

  • With the first syntax (using the targetObj parameter), the command returns the first section intersected by the range or the element. You can pass in targetObj:
    • a range, or
    • an element (table / row / paragraph / body / text box / header / footer). You cannot pass a subsection, nor an anchored picture (an error is returned in this case).
      If the range or element belongs to a header or a footer, WP Get section returns the section to which the header or footer is attached. If the range or element is or belongs to a text box, WP Get section always returns the first section, except if it is anchored to a section (in which case the section is returned).
  • With the second syntax (using the wpDoc parameter), the command returns the section corresponding to the specified sectionIndex section (sectionIndex value must be >=1).
    If no section is defined for the specified sectionIndex, the command returns an undefined object (no error is returned).

Note: Use the WP Get subsection command to get a subsection from a section or from a range.

Example

You want to get the first section:

 var $section : Object
  // get reference of the first section
 $section:=WP Get section(wpDoc;1)

See also

WP Get sections
WP Get subsection