PRINT DATA With Macro Substitution

Moderator: Rathinagiri

Post Reply
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

PRINT DATA With Macro Substitution

Post by hmgchang »

Dear Masters and Friends,

How to use the PRINT DATA with macro subtitution ( &) ?

Code: Select all

aLabel := { "one", "two", 1000000}
           
aFont  := { { "Verdana", 10, "BOLD ITALIC UNDERLINE"}, ;
            { "Arial", 09, "BOLD ITALIC"}, ;
            { "Courier", 10, "BOLD"}}

FOR nLabel := 1 TO LEN( aLabel)
  nRow  := ( nLabel - 1) * 4
  nCol  := 5 + 4
  
  cBIU := aFont[ nLabel, 3] 
  @ nRow, nCol PRINT T_AllToChar( aLabel[ nLabel]) ;
    FONT aFont[ nLabel, 1] ;
    SIZE aFont[ nLabel, 2] 
    &cBIU
    // CENTER
    
NEXT
Get an compile error !

TIA

Best Rgds,
Chang
Just Hmg It !
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: PRINT DATA With Macro Substitution

Post by Rathinagiri »

Code: Select all

@ nRow, nCol PRINT T_AllToChar( aLabel[ nLabel]) ;
    FONT aFont[ nLabel, 1] ;
    SIZE aFont[ nLabel, 2] ;
    &cBIU
Did you miss the ; in the third line?

Tried in a single line?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: PRINT DATA With Macro Substitution

Post by mol »

hmgchang wrote:Dear Masters and Friends,

How to use the PRINT DATA with macro subtitution ( &) ?

Code: Select all

aLabel := { "one", "two", 1000000}
           
aFont  := { { "Verdana", 10, "BOLD ITALIC UNDERLINE"}, ;
            { "Arial", 09, "BOLD ITALIC"}, ;
            { "Courier", 10, "BOLD"}}

FOR nLabel := 1 TO LEN( aLabel)
  nRow  := ( nLabel - 1) * 4
  nCol  := 5 + 4
  
  cBIU := aFont[ nLabel, 3] 
  @ nRow, nCol PRINT T_AllToChar( aLabel[ nLabel]) ;
    FONT aFont[ nLabel, 1] ;
    SIZE aFont[ nLabel, 2] 
    &cBIU
    // CENTER
    
NEXT
Get an compile error !

TIA

Best Rgds,
Chang
Only way, I found to use variables to define bold, italic, underline was to convert @ nRow, nCol PRINT phrase to function:

Code: Select all

_HMG_PRINTER_H_PRINT ( _HMG_SYSDATA[374], nStartRow, nStartCol ,;
			cFontName, nFontSize,;
			nColorR, nColorG, nColorB ,;
			cTextToPrint ,;
			lBold, lItalic, lUnderline, lOverline ,;
			.T. ,;
			.T. ,;
			.T. ,; 
			cJust )
for multilines printout:

Code: Select all

_HMG_PRINTER_H_MULTILINE_PRINT ( _HMG_SYSDATA[374], nStartRow, nStartCol ,;
			nEndRow, nEndCol,;
			cFontName, nFontSize,;
			nColorR, nColorG, nColorB ,;
			cTextToPrint ,;
			lBold, lItalic, lUnderline, lOverline ,;
			.T. ,;
			.T. ,;
			.T. ,; 
			cJust )
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: PRINT DATA With Macro Substitution

Post by hmgchang »

Yes Mr. Diamond, I missed the colon... thks
Good suggestion Mr. Marek Olszewski and thks, I will give a try...
but should i include any file or libs ?
Just Hmg It !
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: PRINT DATA With Macro Substitution

Post by hmgchang »

Salute for Mr. Mol...
It is working now... thks a lot...
BTW, any idea what the 3 boolean( .T.) after the lOverLine ?
Just Hmg It !
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

PRINT DATA With Macro Substitution

Post by Pablo César »

hmgchang wrote:BTW, any idea what the 3 boolean( .T.) after the lOverLine ?
It's about of: <.lcolor.>,<.lfont.>,<.lsize.>

According C:\HMG.3.2\INCLUDE\i_print.ch:


_HMG_PRINTER_H_MULTILINE_PRINT ( _HMG_SYSDATA \[ 374 \] , ;
                                 <Row> , ;
                                 <Col> , ;
                                 <ToRow> , ;
                                 <ToCol> , ;
                                 <cFontName> , ;
                                 <nFontSize> , ;
                                 <aColor>\[1\] , ;
                                 <aColor>\[2\] , ;
                                 <aColor>\[3\] , ;
                                 <cText> , ;
                                 <.bold.> , ;
                                 <.italic.> , ;
                                 <.underline.> , ;
                                 <.strikeout.> , ;
                                 <.lcolor.> , ;
                                 <.lfont.> , ;
                                 <.lsize.> , ;

                                 <"align"> )
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: PRINT DATA With Macro Substitution

Post by hmgchang »

Thanks very much mr. Cesar.
When the command print preview, it display toolbar for Save
instead of printing... but it only save to .emf ?
How about to other format or PDF ?
Pls help me...


Thks n Rgds
Chang
Just Hmg It !
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

PRINT DATA With Macro Substitution

Post by Pablo César »

hmgchang wrote:When the command print preview, it display toolbar for Save
instead of printing...
ToolBars in HMG_PREVIEW it for your own options. User decides if wants to print or just PREVIEW.
but it only save to .emf ?
In the next HMG release, we can count with others options to convert metafiles to other image format like: "BMP","JPG","GIF","TIFF","PNG".
Screen.PNG
Screen.PNG (69.78 KiB) Viewed 5435 times
How about to other format or PDF ?
For this option, we can count with HMGHPDF it is so simple and very good library. See also an example at C:\HMG.3.2\hfcl\Samples\HMGHPDF\demo.Prg
Pls help me...
Helping in what ? Many question: many responses... you need to study deep into HMG sources. All it is in your own computer when HMG is installed. I suggest to see all HMG examples in SAMPLES folder and you will learn a lot with it.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: PRINT DATA With Macro Substitution

Post by hmgchang »

:D Thks Sirs,
Really the HMGHPDF is wonderful...
only the supported fonts limited .

Best Rgds
Chang
Just Hmg It !
Post Reply