Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to print column headers without row headers in a 4D View area printout
PRODUCT: 4D View | VERSION: 2004 | PLATFORM: Mac & Win
Published On: August 13, 2008

If you want to print the column headers, but not the row headers, in a 4D View area like this:

You cannot use the pv print headers property of the PV SET PRINT PROPERTY command, as in:

PV SET PRINT PROPERTY (MyArea1;pv print headers;pv value on)
PV PRINT (MyArea1)

This will result in the row titles getting printed as well as column titles, like this:

One workaround is to use the PV GET COLUMN HEADER command to get the header info, then after using PV INSERT ROWS to create an empty initial row or two, place the header info in the first row cells and print using the "pv print repeat first row" property instead of "pv print headers". A simple hard-coded example for just the first column would be:

PV GET COLUMN HEADER (MyArea1;1;$MyTitle1)
PV SET CELL TEXT VALUE (MyArea1;1;1;$MyTitle1)

At this point, the 4D View area will look like this (if you were to interrupt the code to look at it):

Then the code could do the actual printout like this:

PV SET PRINT PROPERTY (MyArea1;pv print headers;pv value off )
  `To turn those ugly row & column headers off
PV SET PRINT PROPERTY (MyArea1;pv print repeat first row;1) `Starting row is 1
PV SET PRINT PROPERTY (MyArea1;pv print repeat last row;1) `Ending row is 1
PV PRINT (MyArea1)

And the resulting print job would look like this (with the column headers repeating at the top of each printed page):

At this point, your code can finish cleaning up after itself with the PV DELETE ROWS command, to delete those first two "working rows" used for printing, and the 4D View area will be back to its original state.