4D v17

WP Get header

Home

 
4D v17
WP Get header

WP Get header 


 

WP Get header ( rangeObj ) | (wpDoc ; sectionIndex {; subSectionType} ) -> Function result 
Parameter Type   Description
rangeObj  Object in 4D Write Pro range
wpDoc  Object in 4D Write Pro document
sectionIndex  Longint in Section index
subSectionType  Longint in Sub-section type (wk first page, wk left page, or wk right page)
Function result  Object in 4D Write Pro header reference

The WP Get header command returns a reference to the header associated to the rangeObj range or to the specified sectionIndex of the wpDoc document.

  • With the first syntax (using the rangeObj parameter), the command returns the header of the first page in the range. If a sub-section is active on the page, the command returns the header of the active sub-section, so it always returns the visible header.
  • With the second syntax (using the wpDoc parameter), the command returns the header of the specified sectionIndex section (sectionIndex value must be >=1).
    If the subSectionType parameter is passed, the command returns the header associated to the specified sub-section type. You can pass one of the following constants in the subSectionType parameter:
    Constant Type Value
    wk first page Longint 1
    wk left page Longint 2
    wk right page Longint 3

    If the subSectionType is not specified, the main section header will be returned. In this case, if a sub-section is active, the main section header object is undefined (the main section header is available only if there is no active wk first page or wk left page sub-section).

Example  

You want to copy the header of the first page of a 4D Write Pro document to the headers of all pages of another 4D Write Pro document:

 C_OBJECT($headerSource;$rangeSource;$tempoc;$headerTarget;$rangeTarget)
 
 $headerSource:=WP Get header([TEMPLATES]WPtemplate;1;wk first page//get the first page header of section 1
 $rangeSource:=WP Create range($headerSource;wk start text;wk end text)
 $tempoc:=WP New($rangeSource)
 
 $headerTarget:=WP Get header([Docs]MyWPDoc;1) //all pages of section 1
 $rangeTarget:=WP Create range($headerTarget;wk start text;wk end text)
 
 WP INSERT DOCUMENT($rangeTarget;$tempoc;wk replace)
 



See also 

Using a 4D Write Pro area
WP Create range
WP Get footer

 
PROPERTIES 

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

This command can be run in preemptive processes

 
HISTORY 

Created: 4D v16 R5

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v17)