Print form
Print form ( {aTable ;} form {; formData} {; areaStart{; areaEnd}} ) : Integer
Parámetros | Tipo | Descripción | |
---|---|---|---|
aTable | Tabla | → | Table owning the form, or Default table, if omitted |
form | Text, Object | → | Name (string) of the form, or a POSIX path (string) to a .json file describing the form, or an object describing the form to print |
formData | Object | → | Datos a asociar al formulario |
areaStart | Integer | → | Marcador de impresión, o Área inicial (si se especifica areaEnd) |
areaEnd | Integer | → | Área final (si se especifica areaStart) |
Resultado | Integer | ← | Altura de la sección impresa |
Descripción
The Print form command 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.
En el parámetro form, puede pasar:
- el nombre de un formulario, o
- the path (in POSIX syntax) to a valid .json file containing a description of the form to use (see Form file path), or
- an object containing a description of the form.
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. Para forzar un salto de página entre formularios, utilice el comando PAGE BREAK. Para transferir la impresión a la página siguiente de un formulario cuya altura es superior al espacio disponible, invoque el comando CANCEL antes del comando PAGE BREAK.
Se pueden utilizar tres sintaxis diferentes:
- Impresión de área de detalle
Sintaxis:
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.
- Impresión de área de formulario
Sintaxis:
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:
Constante | Tipo | Valor |
---|---|---|
Form break0 | Integer | 300 |
Form break1 | Integer | 301 |
Form break2 | Integer | 302 |
Form break3 | Integer | 303 |
Form break4 | Integer | 304 |
Form break5 | Integer | 305 |
Form break6 | Integer | 306 |
Form break7 | Integer | 307 |
Form break8 | Integer | 308 |
Form break9 | Integer | 309 |
Form detail | Integer | 0 |
Form footer | Integer | 100 |
Form header | Integer | 200 |
Form header1 | Integer | 201 |
Form header10 | Integer | 210 |
Form header2 | Integer | 202 |
Form header3 | Integer | 203 |
Form header4 | Integer | 204 |
Form header5 | Integer | 205 |
Form header6 | Integer | 206 |
Form header7 | Integer | 207 |
Form header8 | Integer | 208 |
Form header9 | Integer | 209 |
- Impresión de sección
Sintaxis:
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.
formData
Opcionalmente, puede pasar parámetros al form usando el objeto formData o el objeto de clase form automáticamente instanciado por 4D si has asociado una clase de usuario al formulario. Any properties of the form data object will then be available from within the form context through the Form command. Optionally, you can pass parameters to the form using either the formData object or the form class object automatically instantiated by 4D if you have associated a user class to the form.
Para obtener información detallada sobre el objeto de datos del formulario, consulte el comando DIALOG
.
Valor devuelto
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:
- Llamar a PRINT SETTINGS. In this case, you let the user choose the settings.
- Llame a SET PRINT OPTION y GET PRINT OPTION. In this case, print settings are specified programmatically.
Print form crea cada página impresa en la memoria. Cada página se imprime cuando la página en memoria está llena o cuando se llama a PAGE BREAK. Para asegurar la impresión de la última página después de cualquier uso de Print form, debe concluir con el comando PAGE BREAK (excepto en el contexto de un OPEN PRINTING JOB, ver nota). Otherwise, if the last page is not full, it stays in memory and is not printed.
Warning: If the command is called in the context of a printing job opened with OPEN PRINTING JOB, you must NOT call PAGE BREAK for the last page because it is automatically printed by the CLOSE PRINTING JOB command. Si llama a PAGE BREAK en este caso, se imprime una página en blanco.
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. Para imprimir sólo un formulario con dichos objetos, utilice PRINT RECORD en su lugar.
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. En este contexto:
- 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.
Ejemplo 1
El siguiente ejemplo funciona como lo haría un comando PRINT SELECTION. However, the report uses one of two different forms, depending on whether the record is for a check or a deposit:
QUERY([Register]) // Seleccionar los registros
If(OK=1)
ORDER BY([Register]) // Ordenar los registros
If(OK=1)
PRINT SETTINGS // Mostrar cuadros de diálogo de impresión
If(OK=1)
For($vlRecord;1;Records in selection([Register]))
If([Register]Type ="Check")
Print form([Register];"Check Out") // Utilice un formulario para cheques
Else
Print form([Register];"Deposit Out") // Utilice otro formulario para depósitos
End if
NEXT RECORD([Register])
End for
PAGE BREAK // Asegúrese de que se imprime la última página
End if
End if
End if
Ejemplo 2
Consulte el ejemplo del comando SET PRINT MARKER.
Ejemplo 3
This form is used as dialog, then printed with modifications:
El método del formulario:
If(Form event code=On Printing Detail)
Form.lastname:=Uppercase(Form.lastname)
Form.firstname:=Uppercase(Substring(Form.firstname;1;1))+Lowercase(Substring(Form.firstname;2))
Form.request:=Lowercase(Form.request)
End if
The code that calls the dialog then prints its body:
$formData:=New object
$formData.lastname:="Smith"
$formData.firstname:="john"
$formData.request:="I need more COFFEE"
$win:=Open form window("Request_obj";Plain form window;Horizontally centered;Vertically centered)
DIALOG("Request_obj";$formData)
$h:=Print form("Request_var";$formData;Form detail)
Ver también
CANCEL
PAGE BREAK
PRINT SETTINGS
SET PRINT OPTION
Propiedades
Número de comando | 5 |
Hilo seguro | ✗ |