Printing memos more than one page long

Category

Code Based - General

Question

Printing memos more than one page long

Solution

The following code snippet should help you in printing memos that are longer than the current page length:

Example:

{ Initialize the memo buffer, Memobuf, and declare the boolean variable, Finished, }
{ before including the following code }

  MemoBuf.PrintStart := 1.0; { left margin memo position  }
  MemoBuf.PrintEnd := 7.0;   { right margin memo position }
  Finished := false;
  Repeat
    If MemoLines(MemoBuf) > LinesLeft then begin { Print what can fit }
      PrintMemo(MemoBuf,LinesLeft,false);
      NewPage;
    end else begin { Print remaining lines }
      PrintMemo(MemoBuf,0,false);
      Finished := true;
    end; { else }
  until Finished;