FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem in alligning say in report
Posts: 110
Joined: Wed Feb 18, 2009 09:58 AM
Problem in alligning say in report
Posted: Fri Sep 11, 2009 06:28 AM
Hi,can any one help me

Iam using say in my report to print some text on the report.The code is


Code (fw): Select all Collapse
ON init(oReport:Say(0,"SALARY",,,oReport:nRow),;
            oReport:Say(10,"TRAVELLING ALLOWENCE",,,oReport:nRow+100),oReport:Say(10,"INCOME TAX",,,oReport:nRow+150),;
           oReport:Say(10,"PROVIDENT FUND",,,oReport:nRow+200),oReport:Say(10,"PROVIDENT FUND ARRERS",,,oReport:nRow+250),;
           oReport:Say(10,"SALARY ADVANCE",,,oReport:nRow+300),oReport:Say(10,"MOBILE RECOVERY",,,oReport:nRow+350))


above code works fine on my system.Alllignment and position of the text are Correct.But the problem arise When the same code run on another system the position of the say entirely changed.The problem may be due to the difference in font properties nInpHeight and nInpWidth.These values are different on each system.How can i standardize font size.Please help me



regards

Sajith
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Problem in alligning say in report
Posted: Fri Sep 11, 2009 01:51 PM

Sajith,

You have to remember that each printer may have a different resolution. You can get the printer's resolution like this:

nHorz := oRpt:oPrn:nHorzRes()
nVert := oRpt:oPrn:nVertRes()

When you are using nRow + 100, that is 100 pixels and 100 pixels on your printer is not the same as 100 pixels on a printer with a different vertical resolution. So, you are going to have to convert both to actual distances by finding the ratio.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 110
Joined: Wed Feb 18, 2009 09:58 AM
Re: Problem in alligning say in report
Posted: Sat Sep 12, 2009 05:34 AM

Hai James,

 thanks for ur valuable replay.It seems to be different(oPrn:nHorzRes and  oPrn:nVertRes()) on these systems.Is it possible to set common values for this propertiies

regards Sajith

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Problem in alligning say in report
Posted: Sat Sep 12, 2009 06:08 AM

Sajith,

>It seems to be different(oPrn:nHorzRes and oPrn:nVertRes()) on these systems. Is it possible to set common values for this propertiies?

Yes they will be different for different size paper and printer resolutions.

And no you cannot set these values--these are properties of the printer and paper. You have to compensate by calculating the actual distances.

These print device properties return the pixels per inch:

oRpt:oPrn:nLogPixelx(): 300 pixels per inch horizontal
oRpt:oPrn:nLogPixely(): 300 pixels per inch vertical

So, if you are doing nRow + 100 (pixels) that is 100/300 or 1/3 of an vertical inch. 1/3 = 0.33333.

Therefore, to make it always 1/3 inch, then;

Pixels per inch * 0.33333 = Pixels per 1/3 inch

So this will be the same distance down from nRow regardless of the printer's resolution.

oRpt:nRow + (oPrn:nLogPixely() * 0.33333 )

For distances other than 100 pixels you will have to make different calculations. Or, better, you could write a generic routine that you could pass oPrn and the distance in inches (or cm) and it would return the number of pixels for that printer.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 110
Joined: Wed Feb 18, 2009 09:58 AM
Re: Problem in alligning say in report
Posted: Mon Sep 14, 2009 07:27 AM

Dear sir,Many thanks for ur great Support

      i will try it out  and send the feedback soon.

Regards,
sajith

Posts: 110
Joined: Wed Feb 18, 2009 09:58 AM
Re: Problem in alligning say in report
Posted: Wed Sep 23, 2009 01:26 PM
Dear James,Many Many thanks for ur Help

This Code Work fine::

Code (fw): Select all Collapse
ACTIVATE REPORT oReport WHILE ( ! oRecSet:Eof());
       ON init(oReport:Say(0,"Basic Salary",,,oReport:nRow),;
       oReport:Say(0,"Incentives",,,oReport:nRow+ oReport:afont[1]:nInpHeight),;
       oReport:Say(10,"Travelling Allowence",,,oReport:nRow+(oReport:afont[1]:nInpHeight*2)),oReport:Say(10,"DA",,,oReport:nRow+(oReport:afont[1]:nInpHeight*3)),;
       oReport:Say(10,"HRA",,,oReport:nRow+(oReport:afont[1]:nInpHeight*4)) ,oReport:Say(10,"Other Additions",,,oReport:nRow+(oReport:afont[1]:nInpHeight*5)) ,;
      oReport:Say(10,"Income Tax",,,oReport:nRow+(oReport:afont[1]:nInpHeight*6)),;
      oReport:Say(10,"Provident Fund",,,oReport:nRow+(oReport:afont[1]:nInpHeight*7)),oReport:Say(10,"Provident Fund Arrers",,,oReport:nRow+(oReport:afont[1]:nInpHeight*8)),;
     oReport:Say(10,"Salary Advance",,,oReport:nRow+(oReport:afont[1]:nInpHeight*9)),oReport:Say(10,"Mobile Recovery",,,oReport:nRow+(oReport:afont[1]:nInpHeight*10)),;
       oReport:Say(10,"Loss of Pay Amount",,,oReport:nRow+(oReport:afont[1]:nInpHeight*11)),oReport:Say(10,"Insurance Amount",,,oReport:nRow+(oReport:afont[1]:nInpHeight*12)),;
      oReport:Say(10,"Other Deduction",,,oReport:nRow+(oReport:afont[1]:nInpHeight*13)),oReport:SayBitmap(0,0.8, "Icons\RegLogo1.bmp",1.2,0.5),;
       oReport:Say(15,"                       XXXXXX",2,,8),oReport:Separator(1,0.4),;
       oReport:newline(),oReport:Say(25,"                                         XXX,XXXXX",2,,oReport:nTitleUpLine +     oReport:afont[2]:nInpHeight) )

oRecSet:MoveFirst()

  oDlg:END()
  oFont1:END()
  oFont2:END()
  oFont3:END()



RETURN Nil
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Problem in alligning say in report
Posted: Wed Sep 23, 2009 03:02 PM

Sajith,

Glad to hear you got it working.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion