Print form

4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next

version 2004.5 (Modified)


Print form ({aTable; }form{; area1{; area2}}){ Number }

ParameterTypeDescription
aTableTableTable owning the form, or
Default table, if omitted
formStringForm to print
area1NumberPrint marker, or Beginning area (if area2 is specified)
area2NumberEnding area (if area1 specified)
Function resultNumberHeight of printed section

Description

Print form simply prints form with the current values of fields and variables of aTable. It is usually used to print very complex reports that require complete control over the printing process. Print form does not do any record processing, break processing or page breaks. These operations are your responsibility. Print form prints fields and variables in a fixed size frame only.

Since Print form does not issue a page break after printing the form, it is easy to combine different forms on the same page. Thus, Print form is perfect for complex printing tasks that involve different tables and different forms. To force a page break between forms, use the PAGE BREAK command. In order to carry printing over to the next page for a form whose height is greater than the available space, call the CANCEL command before the PAGE BREAK command.

Three different syntaxes may be used:

Detail area printing

Syntax:

   height:=Print form (myTable;myForm)

In this case, Print form only prints the Detail area (the area between the Header line and the Detail line) of the form.

Form area printing

Syntax:

   height:=Print form (myTable;myForm;marker)

In this case, the command will print the section designated by the marker. Pass one of the constants of the Form area theme in the marker parameter:

ConstantTypeValue
Form HeaderLongint200
Form Header1...10Longint201...210
Form DetailLongint0
Form Break0...9Longint300...309
Form FooterLongint100

Section printing

Syntax:

   height:=Print form (myTable;myForm;areaStart;areaEnd)

In this case, the command will print the section included between the areaStart and areaEnd parameters. The values entered must be expressed in pixels.

The value returned by Print form indicates the height of the printable area. This value will be automatically taken into account by the Get printed height command.

The printer dialog boxes do not appear when you use Print form. The report does not use the print settings that were assigned to the form in the Design environment. There are two ways to specify the print settings before issuing a series of calls to Print form:

Call PRINT SETTINGS. In this case, you let the user choose the settings.

Call PAGE SETUP. In this case, print settings are specified programmatically.

Print form builds each printed page in memory. Each page is printed when the page in memory is full or when you call PAGE BREAK. To ensure the printing of the last page after any use of Print form, you must conclude with the PAGE BREAK command. Otherwise, if the last page is not full, it stays in memory and is not printed.

Starting with version 2004.5 of 4D, this command prints external areas and objects (for example, 4D Write or 4D View areas). The area is reset for each execution of the command.

Warning: Subforms are not printed with Print form. To print only one form with such objects, use PRINT RECORD instead.

Print form generates only one On Printing Detail event for the form method.

4D Server: This command can be executed on 4D Server within the framework of a stored procedure. In this context:

Make sure that no dialog box appears on the server machine (except for a specific requirement).

In the case of a problem concerning the printer (out of paper, printer disconnected, etc.), no error message is generated.

Examples

1. The following example performs as a PRINT SELECTION command would. However, the report uses one of two different forms, depending on whether the record is for a check or a deposit:

   QUERY([Register])  ` Select the records
   If (OK=1) 
      ORDER BY([Register])  ` Sort the records
      If (OK=1) 
         PRINT SETTINGS ` Display Printing dialog boxes
         If (OK=1) 
            For ($vlRecord; 1; Records in selection([Register]))
               If ([Register]Type = "Check") 
                  Print form ([Register]; "Check Out") ` Use one form for checks
               Else 
                  Print form ([Register]; "Deposit Out")   ` Use another form for deposits
               End if 
               NEXT RECORD([Register]) 
            End for 
            PAGE BREAK ` Make sure the last page is printed
         End if
      End if
   End if

2. Refer to the example of the SET PRINT MARKER command.

See Also

CANCEL, PAGE BREAK, PAGE SETUP, PRINT SETTINGS.


4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next