Loading...
 

PutLine

PutLine

PutLine

Stack
Stack Position Description
Stack(In) Top ]
Top 1 Parameter n
. . . . . .
Top-n Parameter 1
Top n-1 [
Stack(Out) -

PutLine places the information controlled by the parameters as a line on the document contained in the vector.
This means that a line is marked for printing, which is printed out with PrintDocument after completion (see example below).

The following parameters can be transferred:

Parameters
Parameters Description Default value
1 document a document created with Document mandatory
2 x Column Default x = 0
3 y line Default: the current line
4 RIGHT_ADJUST x defines the right margin position
5 LF Line break the text is still on the current line
6 NL Line break like LF, but never triggers a sheet change
7 FF Page change the text is still on the current page
8 COLOR col Colour Default col = BLACK
9 FONT f Font Default f = 2
10 FLAG flg Flags for ViewExport Default flg = 0
11 HEADER a heading line
12 "... %s ..." format string for sprintf
13 CLIP Clipping for window objects No clipping
14 COLUMN n The right margin is reset to the beginning of column n (starting at column 0) Default = 0, normal behaviour at page margin
15 Information to be output any value that can be represented as a string
16 Window object to be inserted
  • The Document object - parameter 1 in the table above - must be passed in any case.
  • The coordinates x and y (parameters 2 and 3) are given in the order x, y, following the usual convention. If there is only one position value, this is the x-coordinate (column) and the text is inserted in the current line. If no unit is specified (as CX_VALUE objects) these coordinates are interpreted as character positions according to the CPI/LPI specification of the document (see SetParameter). Theoretically coordinates and as CX_AMOUNT or CX_VALUE objects also as data to be printed (parameter 15) can be interpreted. The priority, however, lies with the coordinates. This means that only when the coordinates are occupied (by integer or CX_AMOUNT derived objects) the next object is considered as information to be printed. If, for example, a CX_VALUE object is to be output without both coordinates being set, the value to be output must first be converted into a string.
  • Parameters 4 to 14 are format attributes and control where and how the text information is output on the printed page. All attributes are optional; they can be specified in any order.
  • If neither x nor y are specified, the text is chained to the previously output text element. In this way, longer texts can be inserted into the document without first having to form an extremely long character string.
  • Attribute LF increases the current line number after the text is inserted. The same applies to headings - indicated by attribute HEADER - where the current heading line is independent of the current text line. The height of the line depends on the current font.
  • LF, NL and FF indicated several times trigger multiple side or sheet feeds. If you want to avoid that logically related lines are separated by a page change, use NL instead of LF.
  • With FLAG flags can be passed to the conversion function of an object (ViewExport).
  • If the twelfth parameter is specified, the string is further modified as input for sprintf.
  • After the elements of the format list - i.e. further towards the stack top - we describe what information should appear in the document. This can simply be a string, but also any object that can be transformed into a string using the ViewExport function. Flags control the output conversion.
  • \n characters occurring within a character string trigger line breaks; the following substring is in the following line from the same x-position, whereby the internal line counter increases (like NL). Symbol &PAGE in a character string is replaced by the current page number. Lines separated by \n can be used to keep related lines on one page.
  • With the format specification COLUMN, which only makes sense for widgets in list form, the document can be formatted so that the position of the specified column describes the right edge of the document. Anything to the right of this position will therefore only be printed on the margin page. A COLUMN statement always applies to the entire document. If several lists are printed with a COLUMN statement, the last one applies.
  • Besides the text output - indicated by line 15 of the table - there is another possibility: Data of a window object are transferred into the document(line 16). Instruction Widget brings a window object onto the stack. In principle, the entire contents of the window elements are always printed, not those currently displayed. In the case of an object box, for example, all lines are transferred, regardless of which section is currently visible. In case of an object with Children - Window, header etc. - the child objects are inserted into the document according to their relative positions in the parent object. Child widgets with the flag NO_PRINT are not transferred to the print list. For an object box, individual columns with flag NO_PRINT can be hidden in the format specification. NO_PRINT has no effect on the widget, which is transferred directly to the document with PutLine. Lists are formatted according to the format instructions and optimised for printing, so that the printout may differ from the screen display.
  • By default, print elements that do not fit completely on one page are repeated on a margin page. This behaviour can be prevented with the CLIP flag. CLIP in PutLine overwrites the CLIP flag in the widget definition. Lists deviate slightly from this behaviour: If a column only partially fits on one page, the entire column is printed on the next page without the CLIP flag. With the CLIP flag, this column is cut off at the edge of the page and not repeated.

The general settings for the document, such as page margins, CPI, LPI, etc., can be set via SetParameter.

Example:

Fixed line default (here third parameter):

Var(printDoc)

SetPrinter ifnot return

Document(60, 5) -> printDoc

// Row 1 (here the third parameter)

[ printDoc, 1, 1, "Wareneingang:" ] PutLine

[ printDoc, 6, 1, receivingItem Copy(UniqueID()) ] PutLine

 

// Row 2

[ printDoc, 1, 2, "Teil:" ] PutLine

[ printDoc, 6, 2, item Copy(UniqueID()) ] PutLine

[ printDoc Dup Page 1 + String, "Seite" Swap + , FF ] PutLine

printDoc PrintDocument

Dynamic line feed (LF = "Line Feed" line break is executed at the end of the line):

Var(printDoc)

SetPrinter ifnot return

Document(60, 5) -> printDoc

// Row 1 (third parameter)

[ printDoc, 1, "Wareneingang:" ] PutLine

[ printDoc, 6, LF, receivingItem Copy(UniqueID()) ] PutLine

 

// Row 2

[ printDoc, 1, "Teil:" ] PutLine

[ printDoc, 6, LF, item Copy(UniqueID()) ] PutLine

[ printDoc Dup Page 1 + String, "Seite" Swap + , FF ] PutLine

printDoc PrintDocument

The line specification can either be fixed,