4D Write Pro: Say hello to table headers

Tables are an essential part of 4D Write Pro. They evolve regularly by offering new presentation options. For example, a table can be displayed on several columns or pages. The table headers are repeated at the top of each column or page to make it easier for the user to read.

Starting with 4D v19 R5, the table can be enhanced with headers.

Define headers in 4D Write Pro tables

Tables and contents

When we think of tables, we often have a list in mind. Whether it’s people, products, or whatever, the first row is usually used to display a label corresponding to the content of the columns. 

Headers ON EACH PAGE… or column.

When tables contain a large number of rows, automatic column or page breaks occur. In this case, it’s usually convenient to reproduce the header line at the top of each new page. Of course, this is also worth doing when a page is split into two or more columns.

Basically, you want this!

This functionality is now available in a straightforward way. You can define for a given table how many header rows it has.

WP SET ATTRIBUTES($table;wk row header count;5) // New!!!

Of course, you can also read this attribute.

WP GET ATTRIBUTES($table;wk row header count;$headerRows) // New!!!

Standard action

A standard action shall be available to define which row(s) should be used as a header. Just put the cursor inside the table, and select the proper value (0 to 5), that’s it!

The standard action “table/headerRowCount” is available as a menu…

blank

or as a simple drop-downblank

Where are my header rows?

Once the header rows have been set or if the document has been imported, you may want to get the table’s header row range in order to set up a specific style for these rows, right? Let’s say you’d like a white title on a navy blue background.

The WP Table get rows command has been updated, and you can now use the constant wk header rows to get the header rows!

$range:=WP Table get rows($table; wk header rows)  // *** NEW *** !
WP SET ATTRIBUTES($range; wk text color; "white"; wk background color; "navy")

blank

4D Write Pro Interface Widgets

The Table Property menu includes the new item: “Number of header rows” in the sidebar or toolbar widget.

blank

Don’t forget the source code of the 4D Write Pro interface is available on GitHub. Feel free to adapt it to your needs!

Conclusion

This feature brings another useful table display option, available either by programming or through the provided interface.

This feature makes it easier to design 4D Write Pro documents with tables filled with data from your database. More functionalities integrating ORDA will come in the future. Stay tuned!

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.