In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

RichEdit lines printed per page

Xailer professional forum in English
User avatar
Posts: 1075
Joined: Wed Apr 01, 2009 4:12 pm
Location: emeasoft

RichEdit lines printed per page

Postby emeasoft » Tue May 07, 2019 3:24 pm


There is a way to retrieve the number of lines that can be printed per page using a RichEdit?
Considering I'm using a A4 paper, that is 210x297mm sized, I need to fix the first and last line printed in each page.
Counting the number of lines doesn't help, cause the text font size can vary and it leads the "fixed" lines to be printed in the wrong places.

What the "GetPrintHeight" RichEdit method returns exactly?


André Corrêa
User avatar
Site Admin
Posts: 8713
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain

Re: RichEdit lines printed per page

Postby ignacio » Fri May 10, 2019 11:46 am


Sample send from Pedro Gil (Our RichEdit master):

Code: Select all

    // A4 -> 2100 x 2970 mm;
    // Left margin = 250 mm;
    // Top margin = 150 mm;

    LOCAL aRect := { 250, 150, 1850, 2820 } // left, top, right, bottom [size of printing area]
    LOCAL nFrom := 0 // first char to be printed

    Printer:lPreview := .T.
    Printer:oCanvas:nMapMode := mmHIMETRICS

    WITH OBJECT Printer:oCanvas
       WHILE ( nFrom := :DrawRichEdit( aRect, oRichEdit, nFrom ) ) != -1 // end of file

          MsgInfo( nFrom ) -> Last char printed per page
          MsgInfo( oRichEdit:GetLineFromChar( nFrom ) ) -> Last line printed per page


Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]

Return to “English”