KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Programmatically setting the page orientation of a 4D Write Pro document
PRODUCT: 4D Write Pro | VERSION: 17 | PLATFORM: Mac & Win
Published On: April 18, 2019
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

4D v17R3 includes powerful new functionality that was added to 4D Write Pro. One of these new feature is the ability to programmitcally set the Page Orientation like this:

WP SET ATTRIBUTES(wpDoc; wk page orientation; wk landscape)
$section:=WP Get section(wpDoc;2)
WP SET ATTRIBUTES($section; wk page orientation; wk portrait)

The feature above is a v18 feature that is first made available in v17R3.

If you need similar functionality in v17 then the INVOKE ACTION command may be able to help.

Here is an example of setting the document to Landscape mode:
// set 4D Write Pro document to landscape
INVOKE ACTION("pageOrientation?value=landscape")
// the 4D Write Pro area must have focus when this code runs



Here is an example of setting the document to Portrait mode:
// set 4D Write Pro document to portrait
INVOKE ACTION("pageOrientation?value=portrait")
// the 4D Write Pro area must have focus when this code runs

The main caveat with INVOKE ACTION is that the object must have focus when the code runs.