This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
WP Get page count

WP Get page count 


 

WP Get page count ( targetObj ) -> Function result 
Parameter Type   Description
targetObj  Object in 4D Write Pro document or section
Function result  Longint in Number of pages in document

The WP Get page count command returns the total number of pages defined in the targetObj you passed in parameter.

In targetObj, you can pass:

  • a section / subsection, or
  • a 4D Write Pro document

The command returns the number of pages of the targetObj. If you pass a subsection, the number of pages of the parent section is returned.

The same viewing settings as for the WP PRINT command are used with WP Get page count:

  • headers: visible
  • footers: visible
  • expressions: computed and displayed
  • page mode: page or draft

If targetObj is displayed in a 4D Write Pro form area, make sure that viewing settings of the area match the command viewing settings to get consistent information. Note also that if these settings are different in the area, 4D Write Pro will have to "clone" the document to calculate the layout at each call of the command, which can be time consuming. For performance reasons, it is recommended in this case to build the document offline and to copy it to the form object area only when the build is complete.

Example  

You want to know the total number of 4D Write Pro document pages stored in the "Manual" field within the current selection of items. You can write:

 C_LONGINT($pageCount)
 C_LONGINT($totalCount)
 FIRST RECORD([Items])
 While(Not(End selection([Items]))
    $pageCount:=WP Get page count([Items]Manual)
    $totalCount:=$totalCount+$pageCount
    NEXT RECORD([Items])
 End while
 ALERT("Total number of manual pages: "+String($totalCount))

 
PROPERTIES 

Product: 4D
Theme: 4D Write Pro Language
Number: 1412

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v16
Modified: 4D v17 R3

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v20 R7)