4D Write Pro: WP commands and beyond

We’ve received comments on the forum and TAOW about features that previously existed in the 4D Write plug-in but seem to be missing in 4D Write Pro. Yet, they’ve been available for a long time!

In this blog post, we’ll go through a list of existing abilities in 4D Write Pro that seem to have gone unnoticed. In another words, 4D Write Pro features you didn’t know existed.

After all, 4D Write Pro is not limited to WP commands!

Create an off-screen document

“Where are 4D Write’s off-screen commands?” These commands don’t exist anymore in 4D Write Pro, simply because they make no sense.

The 4D Write Pro document is a 4D object. A complex object with many attributes and several levels of involvement, but always an object. First, you instantiate your object with WP NEW. Then, you can manipulate it in memory with 4D commands. At the end, if you want to see what the document looks like, associate your object with a 4D Write Pro area to display it on the screen.

Manipulate the 4D Write Pro area

The 4D Write Pro area is a form object just like other form objects. Thus, the “OBJECT” theme commands apply to the 4D Write Pro area.

For example, you want to display a document as read-only in order for a user to be able to read the document and select parts of it to copy, but not modify the document. It’s very simple, use the classic command: OBJECT SET ENTERABLE.



4D Write Pro is fully integrated in 4D. So 4D’s printing commands also apply to 4D Write Pro, such as SET PRINT PREVIEW, PRINT SELECTION, etc. Check out these old blog posts on the different possibilities for printing.

Let’s say you want to send an invitation to each of your customers, and in the header of your document, you want to change the first and last name for each customer. Easy:

// Get your 4DWP sample
// Query your data
SET PRINT PREVIEW(True) // No need to waste paper
APPLY TO SELECTION([People];WP PRINT([WP_Samples]Sample))

Insert page number or other expressions

You want to insert the page number in the footer of a document, but you can’t find the WP command to insert an expression? Did you look in the ST command theme?

It’s never too late. Check out the ST INSERT EXPRESSION command:

$footer:=WP New footer($subSection)
$oNewRange:=WP Create range($footer;wk start text;wk end text)
ST INSERT EXPRESSION($oNewRange;"$wp_pageNumber")

In the same way, you can add the total number of pages, the creation date, and so on. See the documentation for more details.

To conclude …

Something important to consider: 4D Write Pro is integrated in 4D, which means that you can use 4D commands on a 4D Write Pro area. You’re not limited just to the WP commands.

So think outside the box. A lot of things can be achieved with 4D Write Pro. The sky’s the limit.

Vanessa Talbot
• Product Owner •Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.