FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Function to Print Memo with proportional font.
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Function to Print Memo with proportional font.
Posted: Sat Oct 29, 2016 05:16 PM

Is there a memo print function that will work with Proportional Spaced Fonts.

i.e.

PrintMemo( cText,oPrn,oFont,nWidthInInches)

Maybe is could return an array with the number elements same as lines created.

Step through this and your done.

Just curious,

Byron ...

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 102
Joined: Sat Jun 06, 2015 06:57 PM
Re: Function to Print Memo with proportional font.
Posted: Sat Oct 29, 2016 07:18 PM

oPrn:gettextwidth(ctext, oFont) is useful for this

Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: Function to Print Memo with proportional font.
Posted: Sat Oct 29, 2016 10:49 PM

Yes, thank you, I figured out that much, seems to be more effort in breaking the lines at the right place. I'll probably get it, but I was just trying to see if it was out there.

Thanks,

Byron ...

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Function to Print Memo with proportional font.
Posted: Sun Oct 30, 2016 04:45 AM
Very very simple, if you are using FWH 16.04 or later. You do not need to calculate any thing.

Please use this syntax:
Code (fw): Select all Collapse
#xcommand @ <nRow>, <nCol> PRINT TO <prn> TEXT <cText> ;
      [SIZE <nWidth> [,<nHeight>] ] ;
      [<unit: PIXEL,MM,CM,INCHES>] ;
      [FONT <fnt>] ;
      [ALIGN <aln>] ;
      [COLOR <nTxt> [,<nBck> ] ] ;
      [LASTROW <lrow>] ;


Example: If we want to print a multi-line text or an array of text lines, from row at 3 inches and column at 2.5 inches with a width of 3.5 inches, then
Code (fw): Select all Collapse
@ 3, 2.5 PRINT TO oPrn TEXT cMultiLineText SIZE 3.5 INCHCES FONT oFont LASTROW nNextRow


This command prints the text in multi-line, splitting the text appropriately. This takes as much height as required, because we did not specify the height. After printing, this returns the last row (in inches) used for printing the last line.
We can use the nNextRow to begin print of next element.

If we do not specify the width, then this method uses the entire width of the page starting from 2.5 inches on left.

This command can be used for small text or memo (multi-line) or even an array of text lines.

The vairiable cMultiLineText can also be a codeblock in which case, the codebolck is evaluated. If this value is of another data-type, it is converted as text.
Regards



G. N. Rao.

Hyderabad, India
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: Function to Print Memo with proportional font.
Posted: Sun Oct 30, 2016 04:53 AM

Now that's an answer. Thank you, I believe I have the FDN so I will check for that version. I believe I am currently running 15.xx, with Borland cc7 .

Thanks, again.

Byron ...

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Function to Print Memo with proportional font.
Posted: Sun Oct 30, 2016 08:30 AM
Hello Byron,
I use "EasyReport".
Best regards,
Otto

Code (fw): Select all Collapse
function memoDruck( cTextNeu, cTitle  )
    local druckzeile := ""
    local lPreview  := .t.
    local oVRD
    local Zeilen        := 0
   *----------------------------------------------------------

    EASYREPORT oVRD NAME ".\xVRD\druckmemo.vrd" ;
        PREVIEW lPreview TO Setup():PRNStandard OF WndMain()  PRINTDIALOG IIF( lPreview, .T., .F. ) MODAL

        IF oVRD:lDialogCancel = .T.
            RETURN( .F. )
        ENDIF
    
        PRINTAREA 1 OF oVRD ;
        ITEMIDS    { 101,102 } ;
        ITEMVALUES { cTitle, dtoc(Date()) + " - " + time() }
  
        Zeilen = MLCOUNT( cTextNeu, 80 )
        FOR Zeile= 1 TO Zeilen
            Druckzeile=MEMOLINE(cTextNeu,80,Zeile,12)
    
             PRINTAREA 2 OF oVRD ;
                ITEMIDS    { 101 } ;
                ITEMVALUES { Druckzeile  }
       
            IF oVRD:nNextRow > oVRD:nPageBreak
                PAGEBREAK oVRD
        
            ENDIF
    
        NEXT
  
    oVRD:End()

RETURN (NIL)
//----------------------------------------------------------------------------//
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Function to Print Memo with proportional font.
Posted: Sun Oct 30, 2016 08:44 AM
ER designer

Continue the discussion