4D v17

WP Get page count

Home

 
4D v17
WP Get page count

WP Get page count 


 

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

The WP Get page count command returns the total number of pages defined in the wpDoc 4D Write Pro document.

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 wpDoc 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

 
HISTORY 

Created: 4D v16

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v17)