calculate the column (Arial)
calculate the column (Arial)
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
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)
I don't understand your question.
Are you saying that you want to align the right side of the text at a specified column?
Are you saying that you want to align the right side of the text at a specified column?
The eXpress train is coming - and it has more cars.
Re: calculate the column (Arial)
Hi Roger I print multiple columns of text and numeric and wish that align with a font (Arial).
thanks
Miguel
thanks
Miguel
Re: calculate the column (Arial)
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
As I can automatically calculate the position of each column using Arial
regards
Miguel
- Attachments
-
- Columnas.gif (10.96 KiB) Viewed 14746 times
Re: calculate the column (Arial)
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.
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)
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
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)
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
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
- Attachments
-
- columnas2.gif (12.79 KiB) Viewed 14724 times
Re: calculate the column (Arial)
Look at DC_GraQueryTextBox()
The eXpress train is coming - and it has more cars.
Re: calculate the column (Arial)
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
nCol+=DC_GraQueryTextBox(replicate ("W", Nlong + (int (Nlong * 0.8))), cFuente) [1]
regards
Miguel
-
- Posts: 42
- Joined: Mon Dec 23, 2013 2:10 pm
- Contact:
Re: calculate the column (Arial)
Look GraQueryTexBox():
Example:
aText:=GraQueryTexBox(NIL,VarC)
Length:=aText[3,1]-aText[1,1]
Example:
aText:=GraQueryTexBox(NIL,VarC)
Length:=aText[3,1]-aText[1,1]