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
Responder
Avatar de Usuario
emeasoft
Mensajes: 1088
Registrado: Mié Abr 01, 2009 4:12 pm
Ubicación: emeasoft
Contactar:

RichEdit lines printed per page

Mensaje por emeasoft »

Hi,

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?

TIA,

André Corrêa
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: RichEdit lines printed per page

Mensaje por ignacio »

Hi,

Sample send from Pedro Gil (Our RichEdit master):

Código: Seleccionar todo

    // 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:StartDoc()
    Printer:StartPage()
    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

       ENDDO
    END

    Printer:EndPage()
    Printer:EndDoc()
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Responder