printing optionally BOLD, ITALIC, UNDERLINE

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

printing optionally BOLD, ITALIC, UNDERLINE

Post 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?
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: printing optionally BOLD, ITALIC, UNDERLINE

Post 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> ) )
Last edited by edk on Wed Oct 18, 2017 10:47 am, edited 1 time in total.
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: printing optionally BOLD, ITALIC, UNDERLINE

Post by mol »

Yes, Edward.
I'm modifying PRINT command to get acceptable result
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: printing optionally BOLD, ITALIC, UNDERLINE

Post 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 :)
Last edited by mol on Wed Oct 18, 2017 11:03 am, edited 1 time in total.
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: printing optionally BOLD, ITALIC, UNDERLINE

Post by edk »

Brawo TY :lol: usuń ] z cAlignment] ;)
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: printing optionally BOLD, ITALIC, UNDERLINE

Post by mol »

edk wrote: Wed Oct 18, 2017 10:41 am usuń ] z cAlignment] ;)
Zrobione! Done! :D
User avatar
serge_girard
Posts: 3158
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: printing optionally BOLD, ITALIC, UNDERLINE

Post by serge_girard »

Very usefull ! Thanks.

Serge
There's nothing you can do that can't be done...
User avatar
Anand
Posts: 595
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF

Re: printing optionally BOLD, ITALIC, UNDERLINE

Post by Anand »

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

Serge
+1

Regards,

Anand
Regards,

Anand

Image
Post Reply