Problem in alligning say in report

Post Reply
sajith
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India
Contact:

Problem in alligning say in report

Post by sajith »

Hi,can any one help me

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

Code: Select all

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Problem in alligning say in report

Post by James Bott »

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
sajith
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India
Contact:

Re: Problem in alligning say in report

Post by sajith »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Problem in alligning say in report

Post by James Bott »

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
sajith
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India
Contact:

Re: Problem in alligning say in report

Post by sajith »

Dear sir,Many thanks for ur great Support

i will try it out and send the feedback soon.

Regards,
sajith
sajith
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India
Contact:

Re: Problem in alligning say in report

Post by sajith »

Dear James,Many Many thanks for ur Help

This Code Work fine::

Code: Select all



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


 
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Problem in alligning say in report

Post by James Bott »

Sajith,

Glad to hear you got it working.

Regards,
James
Post Reply