Function to Print Memo with proportional font.

Function to Print Memo with proportional font.

Postby byron.hopp » Sat Oct 29, 2016 5: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
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Function to Print Memo with proportional font.

Postby dtussman » Sat Oct 29, 2016 7:18 pm

oPrn:gettextwidth(ctext, oFont) is useful for this
dtussman
 
Posts: 97
Joined: Sat Jun 06, 2015 6:57 pm

Re: Function to Print Memo with proportional font.

Postby byron.hopp » 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
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Function to Print Memo with proportional font.

Postby nageswaragunupudi » Sun Oct 30, 2016 4: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: Select all  Expand view

#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: Select all  Expand view

@ 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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Function to Print Memo with proportional font.

Postby byron.hopp » Sun Oct 30, 2016 4: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
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Function to Print Memo with proportional font.

Postby Otto » Sun Oct 30, 2016 8:30 am

Hello Byron,
I use "EasyReport".
Best regards,
Otto

Code: Select all  Expand view

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)
//----------------------------------------------------------------------------//
 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6313
Joined: Fri Oct 07, 2005 7:07 pm

Re: Function to Print Memo with proportional font.

Postby Otto » Sun Oct 30, 2016 8:44 am

ER designer

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6313
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 67 guests