printing optionally BOLD, ITALIC, UNDERLINE

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
mol
Posts: 2856
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 125 times
Been thanked: 65 times
Contact:

printing optionally BOLD, ITALIC, UNDERLINE

Post by mol » Wed Oct 18, 2017 9:16 am

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: 171
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 50 times
Been thanked: 99 times

Post by edk » Wed Oct 18, 2017 9:34 am

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: 2856
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 125 times
Been thanked: 65 times
Contact:

Post by mol » Wed Oct 18, 2017 9:52 am

Yes, Edward.
I'm modifying PRINT command to get acceptable result

User avatar
mol
Posts: 2856
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 125 times
Been thanked: 65 times
Contact:

Post by mol » Wed Oct 18, 2017 10:27 am

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: 171
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 50 times
Been thanked: 99 times

Post by edk » Wed Oct 18, 2017 10:41 am

Brawo TY :lol: usuń ] z cAlignment] ;)

User avatar
mol
Posts: 2856
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 125 times
Been thanked: 65 times
Contact:

Post by mol » Wed Oct 18, 2017 11:04 am

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

User avatar
serge_girard
Posts: 1872
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 293 times
Been thanked: 67 times
Contact:

Post by serge_girard » Wed Oct 18, 2017 11:30 am

Very usefull ! Thanks.

Serge

User avatar
Anand
Posts: 210
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 23 times
Been thanked: 33 times

Post by Anand » Thu Oct 19, 2017 10:24 am

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

Serge
+1

Regards,

Anand
Image

Post Reply