Tech Tip: Creating headers and footers programatically in 4D Write Pro object
PRODUCT: 4D | VERSION: 16R5 | PLATFORM: Mac & Win
Published On: March 30, 2018
In order to enable the headers and footers in a 4D Write Pro object, the areas have to be clicked on the form. But what if you need to have this 4D Write Pro object generated programatically? The headers and footers will not be active. Here is a utility method to activate the headers and footers of a 4D Write Pro object:
//--------------------------------------------------------------------------------- // Name: ADD_HEADER_FOOTER_WP_DOC // Description: Method will add a Header and/or Footer in the WritePro object // // Parameters: // $1 (POINTER) - Write Pro object // $2 (LONGINT) - Choice 1 - Header only, 2 - Footer only, 3 - Both // -------------------------------------------------------------------------------- C_POINTER($1;$writePro) C_LONGINT($2;$choice;$posBody) C_TEXT($div;$beforeText;$afterText;$completedText) If (Count parameters=2) $writePro:=$1 $choice:=$2 WP EXPORT VARIABLE($writePro->;$wpHtml;wk web page html 4D) Case of : ($choice=1) // Header $div:="<div class=\"section1Header\" style=\"visibility: hidden; height: 0\"></div>" : ($choice=2) // Footer $div:="<div class=\"section1Footer\" style=\"visibility: hidden; height: 0\"></div>" Else $div:="<div class=\"section1Header\" style=\"visibility: hidden; height: 0\"></div><div class=\"section1Footer\" style=\"visibility: hidden; height: 0\"></div>" End case $posBody:=Position(" |