KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Utility method to return character length of 4D Write Pro document
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: February 22, 2023

Below is a utility method for returning character count in 4D Write Pro which is equivalent to WR Count.

// Description
// Method to return the character length of a 4D Write Pro document
// Parameters
// $1 - WPArea object
// $0 - Character length
// ----------------------------------------------------

C_COLLECTION($elem_c)
C_OBJECT($range)
C_TEXT($text_t)
C_LONGINT($length_l)

$elem_c:=WP Get elements(WPArea)
$length_l:=0

For each ($range; $elem_c)
  $text_t:=WP Get text($range)
  $length_l:=$length_l+Length($text_t)
End for each

$0:=$length_l