Page 1 of 1
calculate the column (Arial)
Posted: Thu Dec 12, 2013 2:08 pm
by MIGUELON
Hi all, hope someone can help me.
The question is: How I can calculate the column in which I print when I use a non-proportional font (Arial)
for we=1 to len(aColumnaIMP)
cImpCol:=aColumnaIMP[we]
Long:=len(aColumnaIMP[we])
if esunnumero(cImpCol)
@ nFila,nColumna DCPRINT SAY cImpCol+" " ALIGN DCPRINT_ALIGN_RIGHT font cFuente COLOR nColor ,naColor WIDTH nLong+1
else
@ nFila,nColumna DCPRINT SAY cImpCol+" " ALIGN DCPRINT_ALIGN_LEFT font cFuente COLOR nColor ,naColor WIDTH nLong+1
endif
// nColSize := oPrinter:ColSize()*4
nColumna+=nLong+1
next
Thanks for your help
Miguel
Re: calculate the column (Arial)
Posted: Thu Dec 12, 2013 2:56 pm
by rdonnay
I don't understand your question.
Are you saying that you want to align the right side of the text at a specified column?
Re: calculate the column (Arial)
Posted: Thu Dec 12, 2013 3:54 pm
by MIGUELON
Hi Roger I print multiple columns of text and numeric and wish that align with a font (Arial).
thanks
Miguel
Re: calculate the column (Arial)
Posted: Thu Dec 12, 2013 4:18 pm
by MIGUELON
The separation between columns is huge if I use as calculation to column size.
As I can automatically calculate the position of each column using Arial
regards
Miguel
Re: calculate the column (Arial)
Posted: Thu Dec 12, 2013 10:44 pm
by skiman
It looks as your "referencia" is a string with lot of spaces. You calculate the lenght for the entire string. If there are 20 spaces, it will never be fine.
Otherwise with a proportional font you can calculate only an extimate. A string with WWWW is a lot wider than IIII. It is also depended if it is uppercase or not.
You can use a coefficient that you can use after some testing.
Example: nColumna+=nLong/1.3+1
You can also calculate the width of a string in pixels, but since it depends on the characters inside the string, the result will be different for each line. So what is a correct width for the first line of your report, is maybe not correct for the second line.
Re: calculate the column (Arial)
Posted: Fri Dec 13, 2013 2:39 am
by MIGUELON
Thanks for the help, the ank reference is only 15 characters and as you will see there is a lot more separation.
I think the right thing would be to know how to calculate the length of a string in PIXEL since as you say not all the characters occupy the same.
Coefficient proves you indicate me and I will hang the result
thanks
Miguel
Re: calculate the column (Arial)
Posted: Fri Dec 13, 2013 2:57 am
by MIGUELON
As you see with the factor has improved but not solved.
The question is to know how to calculate the length of a string to PIXEL is no proportioning font (ARIAL)
I need a similar function LEN () but Pixel
Greetings and thanks
Miguel
Re: calculate the column (Arial)
Posted: Fri Dec 13, 2013 7:04 am
by rdonnay
Look at DC_GraQueryTextBox()
Re: calculate the column (Arial)
Posted: Fri Dec 13, 2013 7:11 am
by MIGUELON
Thank you all for your help but scratch that solved it with the following function :
nCol+=DC_GraQueryTextBox(replicate ("W", Nlong + (int (Nlong * 0.8))), cFuente) [1]
regards
Miguel
Re: calculate the column (Arial)
Posted: Thu Dec 26, 2013 1:54 pm
by messaoudlazhar
Look GraQueryTexBox():
Example:
aText:=GraQueryTexBox(NIL,VarC)
Length:=aText[3,1]-aText[1,1]