4D Write Pro – More control on page layout

Automatically translated from English

4D Write Pro makes it easy to create complex documents. Display and layout attributes can be applied to different parts of the documents, whether they are text, images, or tables. Speaking of tables, they benefit from a new property to better define the layout! Let’s see what 4D v19 R4 has in store for you. 

HDI Breaks inside table rows

Small and large tables

Tables can contain many rows, and the space they occupy in a document can be significant.
When there is not enough space left on a page, there is already an attribute that defines whether a table can be automatically split into two parts or preceded by a page break to fit on the next page.

Up to 4D V19R4, when tables are split into two parts, the separation is always done between two rows. This is usually sufficient because the rows of a table contain only numbers or labels most of the time. On the other hand, when cells have longer text (or even several paragraphs), it may be interesting to allow splitting them in two (and therefore also splitting the table lines) to fill the available space.

New attributes

wk page break inside table allows a table to be split into two (or more) parts, the separation is done between two lines of the table.
 

wk page break inside row also allows to split a table, but this time inside rows. Note that this option is dependent on the previous one. If a table cannot be split, neither can its rows.

This attribute can be applied to a row range, a row element, or to any target. In this last case, just remember that in the end, it is the attributes of the rows that are really affected transparently.

wk page break inside paragraph can be applied to paragraphs, but also to any target such as the document itself, a particular section, a range of text, etc. In all cases, the attribute will actually be assigned to the paragraphs inside the target. This is simply a “quality of life” feature.

 

 

Note: The existing attribute wk page break inside that applied to both paragraphs and tables is now obsolete (but will continue to work for compatibility). It is advantageously replaced by the new more explicit attributes described above.

What will this change?

For new documents, this new option is enabled by default. In fact, it will not change anything if the table rows have only one line of text. On the other hand, if the cells contain one or more paragraphs, these rows will be split automatically.

For documents created with an earlier version, to guarantee their identical layout, this option will be deactivated in all the rows of all the tables when the documents are opened.

Code examples

Sample 1: Allow page breaks inside any row of a table

WP SET ATTRIBUTES($table; wk page break inside row; wk auto)   

Sample2: Allow page breaks inside any row of a table except the first and last rows

You have two ways to program this according to your taste!

#1 Use row ranges

// all rows can be split
WP SET ATTRIBUTES($table; wk page break inside row; wk auto)
// except first
WP SET ATTRIBUTES(WP Table get rows($table; 1; 1); wk page break inside row; wk avoid)
// and last
WP SET ATTRIBUTES(WP Table get rows($table; $table.rowCount; 1); wk page break inside row; wk avoid)

#2 Use row elements

// all rows can be split
WP SET ATTRIBUTES($table; wk page break inside row; wk auto)
// get row elements
$colRows:=WP Get elements($table; wk type table row)
// except first
WP SET ATTRIBUTES($colRows[0]; wk page break inside row; wk avoid)
// and last
WP SET ATTRIBUTES($colRows[$colRows.length-1]; wk page break inside row; wk avoid)

Interface

The interface provided has, of course, been modified to take into account these new attributes in the table and row menu.

Conclusion

New attributes have been created for more clarity, and one has been added for more flexibility in presentation. It’s your turn to create u beautiful layouts and documents!

The list of all attributes and constants can be found in the documentation.

Roland Lannuzel

• Product Owner & 4D Expert •

After studying electronics, Roland went into industrial IT as a developer and consultant, building solutions for customers with a variety of databases and technologies. In the late 80’s he fell in love with 4D and has used it in writing business applications that include accounting, billing and email systems.

Eventually joining the company in 1997, Roland’s valuable contributions include designing specifications, testing tools, demos as well as training and speaking to the 4D community at many conferences. He continues to actively shape the future of 4D by defining new features and database development tools.