Friday, April 27, 2012

Using the DataWindow.DocumentName attribute for printing

The DocumentName attribute is helpful in two ways. If your users print a banner page on a network printer with every printout, the DocumentName will usually print on the banner. Also the DocumentName is used on the standard “printing document” window that displays when you issue a dw_1.Print(). To set the attribute, right-click on a blank area of a DataWindow in the DW Painter and select Properties. Go to the Print Specifications and you will see the Document Name attribute at the top.

This can get tedious if you want to retrofit your already written DataWindows. If all your DataWindows have a standard text or computed field name for the title (e.g., st_title), try adding the following code to your DW or window ancestor object:

// Make sure st_title exists on the DW
IF (dw_1.Describe(“st_title.Band”) <> “!”) THEN
dw_1.Object.DataWindow.Print.DocumentName = dw_1.Object.st_title.Text
END IF

No comments:

Post a Comment