calculate the column (Arial)

This forum is for eXpress++ general support.
Post Reply
Message
Author
MIGUELON
Posts: 135
Joined: Wed Feb 10, 2010 10:55 am

calculate the column (Arial)

#1 Post 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

User avatar
rdonnay
Site Admin
Posts: 4745
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: calculate the column (Arial)

#2 Post 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?
The eXpress train is coming - and it has more cars.

MIGUELON
Posts: 135
Joined: Wed Feb 10, 2010 10:55 am

Re: calculate the column (Arial)

#3 Post by MIGUELON »

Hi Roger I print multiple columns of text and numeric and wish that align with a font (Arial).

thanks
Miguel

MIGUELON
Posts: 135
Joined: Wed Feb 10, 2010 10:55 am

Re: calculate the column (Arial)

#4 Post 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
Attachments
Columnas.gif
Columnas.gif (10.96 KiB) Viewed 13419 times

skiman
Posts: 1194
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: calculate the column (Arial)

#5 Post 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.
Best regards,

Chris.
www.aboservice.be

MIGUELON
Posts: 135
Joined: Wed Feb 10, 2010 10:55 am

Re: calculate the column (Arial)

#6 Post 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

MIGUELON
Posts: 135
Joined: Wed Feb 10, 2010 10:55 am

Re: calculate the column (Arial)

#7 Post 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
Attachments
columnas2.gif
columnas2.gif (12.79 KiB) Viewed 13397 times

User avatar
rdonnay
Site Admin
Posts: 4745
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: calculate the column (Arial)

#8 Post by rdonnay »

Look at DC_GraQueryTextBox()
The eXpress train is coming - and it has more cars.

MIGUELON
Posts: 135
Joined: Wed Feb 10, 2010 10:55 am

Re: calculate the column (Arial)

#9 Post 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

messaoudlazhar
Posts: 42
Joined: Mon Dec 23, 2013 2:10 pm
Contact:

Re: calculate the column (Arial)

#10 Post by messaoudlazhar »

Look GraQueryTexBox():
Example:
aText:=GraQueryTexBox(NIL,VarC)
Length:=aText[3,1]-aText[1,1]

Post Reply