Skip to main content
Version: Next

WP Get formulas

WP Get formulas ( targetObj ) -> Function result

ParameterTypeDescription
targetObjObject🡒Range or element or 4D Write Pro document
Function resultCollection🡐Collection of formulas

Description

The WP Get formulas command returns a collection of all formulas defined in targetObj.

In the targetObj parameter, you can pass:

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

Note: When you pass a section in targetObj, only image formulas or formulas in text boxes anchored to this section or all sections are returned. If anchored to a page or to the embedded view, their formulas are not returned. Pass the document in targetObj to get all anchored element formulas.

Returned value

WP Get formulas returns a collection of formula objects, each of them containing one or more of the following properties:

PropertyTypeDescription
[ ].formulaObjectThe formula string is available through [ ].formula.source. The formula is a copy of the formula found in the target. If you want to modify the formula, it must be re-inserted in the document to be taken into account
[ ].rangeObjectRange of the formula (not returned for anchored picture formulas)
[ ].anchoredIDTextID of anchored picture (returned for anchored picture formulas only)
[ ].nameTextName of the formula, if a name was defined (not returned otherwise). Names can be defined using WP INSERT FORMULA.
[ ].ownerObject4D Write Pro document

Notes:

  • If you passed a subsection as target, formulas of the parent section are returned.
  • If several formulas are returned, the collection is ordered with respect to the formula order in the target, except for targets of type document and section (any order in this case).

Example

To get all formulas in a document:

 var $formulas : Collection
 $formulas:=WP Get formulas(WriteProArea)

To get all formulas in the first section of a document:

 var $formulas : Collection
 $formulas:=WP Get formulas(WP Get section(WriteProArea;1))

To get the formulas of all anchored pictures in a document:

 var $formulas : Collection
 $formulas:=WP Get formulas(WriteProArea).query("anchoredID # null")

See also

Managing formulas
WP COMPUTE FORMULAS
WP FREEZE FORMULAS
WP Get links
WP INSERT FORMULA