Design Guidelines for Printing

Both forms and reports can be used for printing, but report components are the most appropriate choice when you need to provide specialized print control or batch processing. A report component does not allow user interaction or database I/O.

When designing components for printing, consider the following:

  • Keep the component simple. Do not define too many component entities and fields—this impairs maintenance and performance.

  • Design your components so that the maximum degree of selection and sorting occurs before you manipulate the data and format it for printing.

  • You do not need to draw multiple occurrences of an entity. Uniface automatically handles the processing of all occurrences retrieved (when you print with print mode All or Clear).

  • When drawing fields and labels, keep in mind that Uniface expands fields if they contain more data than is visible in the component when printing with print mode All or Clear.

    • For fixed-length fields, draw the field so that it has the same length as the information it contains to prevent the field from wrapping.

    • For variable-length fields, make the field frame as wide as possible.

    • To prevent automatic expansion, create a non-database field and use ProcScript to transform the string extraction.

  • For entities drawn as a single occurrence, the labels are repeated for each instance of entity expansion. However, if more than one occurrence of an entity has been drawn, the label is only printed for the last occurrence drawn in the layout. You can change this behavior by setting the label's Repetition property. For more information, see Label Placement.

  • To handle entities and the labels they contain as single units, draw a named area frame around an entity. This protects text as part of the entity, and allows you to drop the complete contents of the named area frame if, for example, the enclosed entity does not contain data.

  • When printing runs onto another page, use a break frame to repeat the contents of a named area frame above the associated enclosed entity.

  • If you draw two or more entity frames or area frames next to each other, draw the bottom lines of each frame on the same line to ensure attractive print results.

Field Layout

Fields are expanded if they contain more data than is visible on the screen, except in the following instances:

  • Fields in header and footer frames are not expanded. The dimensions of header and footer frames are fixed and cannot change at runtime.

  • Single-line edit boxes are not expanded vertically when printing.

Labels are not repeated on the additional lines, and more than one field on a line can have additional data.

Entity Layout

Uniface uses the height of the entity frame (that is, the value of $framedepth for that entity) to determine if the last line has been printed. After printing the last line, Uniface checks for more occurrences to be printed. If so, the occurrences are printed before Uniface goes to the next line on the form.

If you draw an entity with no fields, and this entity is populated with data when you start printing, Uniface prints an empty line for each occurrence of that entity.

If an entity is nested inside another entity, Uniface prints an occurrence of the outer entity and all associated occurrences of the inner entity before printing the next occurrence of the outer entity. This process continues to as deep a level as has been drawn.

Borders

Uniface expands the borders of frames during the printing process, if necessary.

If you draw two or more entity frames or area frames next to each other, draw the bottom lines of each frame on the same line to ensure attractive print results.

Label Placement

Uniface prints the labels according to strict rules, depending on where they are placed, and whether the label is set to repeat. You can place labels in any of the following places:

  • In the entity frame—If the entity is drawn with only one occurrence, labels are repeated for each occurrence that is retrieved. If the entity is drawn with multiple occurrences, labels are printed for the last occurrence but are not repeated in subsequent occurrences. However, you can change this behavior by setting the label's Repetition property.

  • In a named area frame that surrounds the entity—This allows you to protect text as part of the entity, provide column titles that are treated as part of the entity, or suppress printing of the entity, for example, if it contains no data. However, Uniface does not automatically repeat the contents of a named area frame above the associated enclosed entity when printing flows over onto another page. To repeat this information on a following page, you must use a break frame.

  • In an outer entity—Drawing labels for an inner entity in the surrounding outer entity is similar to drawing a label frame in a named area frame. However, text and occurrences of the inner entity are not protected against page breaks if the page break occurs between the text and the inner entity. Also, if the inner entity is suppressed because there is no data, the detached label text remains.

  • On the component, outside all entities—The label is not contained by any kind of frame. This causes Uniface to print the label once, in the position that it occupies after all expansion of entities and fields has taken place. An unnamed area frame enclosing the text does not affect this rule.

  • In a break frame—Placing a label in a break frame gives you the freedom to print the text at any point where an (entity-level) getFocus or leavePrinted trigger is activated. The printbreak statement is only allowed in the these triggers.

Related Topics