Page 1 of 1

printing optionally BOLD, ITALIC, UNDERLINE

Posted: Wed Oct 18, 2017 9:16 am
by mol
Hi!
Maybe stupid question, but I need to print data with optionally declared BOLD, ITALIC, UNDERLINE

eg.
@ prow, pcol PRINT cText FONT "ARIAL" SIZE 12 if(lBold, BOLD,) if (lItalic, ITALIC,) if (lUnderline, UNDERLINE,)


How I must code it to work?

Re: printing optionally BOLD, ITALIC, UNDERLINE

Posted: Wed Oct 18, 2017 9:34 am
by edk
Look at i_print.ch Maybe this will be useful:

Code: Select all

#xtranslate @ <Row> , <Col> PRINT [ DATA ] <cText> ;
	[ <lfont : FONT> <cFontName> ] ;
	[ <lsize : SIZE> <nFontSize> ] ;
	[ <bold : BOLD> ] ;
	[ <italic : ITALIC> ] ;
	[ <underline : UNDERLINE> ] ;
	[ <strikeout : STRIKEOUT> ] ;
	[ <lcolor : COLOR> <aColor> ] ;
	[ <align:CENTER,RIGHT> ] ;
   [ ANGLE <nAngleInDegrees> ] ;
	=> ;
   iif( _HMG_SYSDATA \[ 513 \],; 
        _HMG_HPDF_PRINT ( <Row> , <Col> , <cFontName> , <nFontSize> , <aColor>\[1\] , <aColor>\[2\] , <aColor>\[3\] , <cText> , <.bold.> , <.italic.> , <.underline.> , <.strikeout.> , <.lcolor.> , <.lfont.> , <.lsize.> , <"align"> ),; 
        _HMG_PRINTER_H_PRINT ( _HMG_SYSDATA \[ 374 \] , <Row> , <Col> , <cFontName> , <nFontSize> , <aColor>\[1\] , <aColor>\[2\] , <aColor>\[3\] , <cText> , <.bold.> , <.italic.> , <.underline.> , <.strikeout.> , <.lcolor.> , <.lfont.> , <.lsize.> , <"align"> , <nAngleInDegrees> ) )

Re: printing optionally BOLD, ITALIC, UNDERLINE

Posted: Wed Oct 18, 2017 9:52 am
by mol
Yes, Edward.
I'm modifying PRINT command to get acceptable result

Re: printing optionally BOLD, ITALIC, UNDERLINE

Posted: Wed Oct 18, 2017 10:27 am
by mol
I've modified PRINT command translation to XPRINT:

Code: Select all

#xtranslate @ <Row> , <Col> XPRINT [ DATA ] <cText> ;
	[ <lfont : FONT> <cFontName> ] ;
	[ <lsize : SIZE> <nFontSize> ] ;
	[ XBOLD <xbold> ] ;
	[ XITALIC  <xitalic> ] ;
	[ XUNDERLINE <xunderline> ] ;
	[ XSTRIKEOUT <xstrikeout> ] ;
	[ <lcolor : COLOR> <aColor> ] ;
	[ XALIGN <align> ] ;
   [ ANGLE <nAngleInDegrees> ] ;
	=> ;
   iif( _HMG_SYSDATA \[ 513 \],;        
        _HMG_HPDF_PRINT ( <Row> , <Col> , <cFontName> , <nFontSize> , <aColor>\[1\] , <aColor>\[2\] , <aColor>\[3\] , <cText> , <xbold> , <xitalic> , <xunderline> , <xstrikeout> , <.lcolor.> , <.lfont.> , <.lsize.> , <align> ),; 
        _HMG_PRINTER_H_PRINT ( _HMG_SYSDATA \[ 374 \] , <Row> , <Col> , <cFontName> , <nFontSize> , <aColor>\[1\] , <aColor>\[2\] , <aColor>\[3\] , <cText> , <xbold> , <xitalic> , <xunderline> , <xstrikeout> , <.lcolor.> , <.lfont.> , <.lsize.> , <align> , <nAngleInDegrees> ) )
Then I can print my data with optional BOLD, ITALIC, UNDERLINE, STRIKEOUT and ALIGNED:

Code: Select all

lBold := .t.
lItalic := .f.
lUnderline := .f.
cAlignment := "CENTER"
@ pRow , pcol XPRINT "some text to print" ;
	FONT "ARIAL CE" SIZE nFontSize COLOR BLACK;
	XBOLD lBold ;
	XITALIC lItalic ;
	XUNDERLINE lUnderline ;
	XALIGN cAlignment


MULTILINE PRINTING can be modified in the same way.


I hope, this solution will be useful for someone :)

Re: printing optionally BOLD, ITALIC, UNDERLINE

Posted: Wed Oct 18, 2017 10:41 am
by edk
Brawo TY :lol: usuń ] z cAlignment] ;)

Re: printing optionally BOLD, ITALIC, UNDERLINE

Posted: Wed Oct 18, 2017 11:04 am
by mol
edk wrote: Wed Oct 18, 2017 10:41 am usuń ] z cAlignment] ;)
Zrobione! Done! :D

Re: printing optionally BOLD, ITALIC, UNDERLINE

Posted: Wed Oct 18, 2017 11:30 am
by serge_girard
Very usefull ! Thanks.

Serge

Re: printing optionally BOLD, ITALIC, UNDERLINE

Posted: Thu Oct 19, 2017 10:24 am
by Anand
serge_girard wrote: Wed Oct 18, 2017 11:30 am Very usefull ! Thanks.

Serge
+1

Regards,

Anand