Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 8 Jahren, 11 Monaten
Letzter Beitrag:
vor 8 Jahren, 11 Monaten
Beteiligte Autoren:
Jimbo, Fabrice Harari, Al, John Marrone

Right align a string

Startbeitrag von John Marrone am 08.08.2009 18:13

Hi All
Does anyone know of a function in WD that would right align a string. I want to print some numbers in a column like so:->


Does WD have a function for this. StringBuild or StringFormat doesn't. Does it exist or am I going to have to do it the hard way.
Like String?(123.45,"XXX.XX"). Thanks for any help.


Hello John

Peter Holemans has posted a nice string handler class on the Windev repository.


von Al - am 08.08.2009 22:05
Hi John

2 things:

- the .xx is obtained by using the proper format for the table column
- the righ alignment is done by selecting right align in the STYLE of the COLUMN (which can be different than the style of the table

Best regards

von Fabrice Harari - am 08.08.2009 22:13
Hi John,

in a report it's easy, because you can define the item / static as right-aligned by

MyItem..HorizontalAlignment = haRight or haLeft or haCenter

if you're printing using iPrint(..) then you have to do it yourself!

W is 4-byte real // will contain the width of the text
R is 4-byte real = 120 // this is the right margin of the column to be printed in mm
N1 is 4-byte real = 123.45 // this is the first number to be printed
N2 is 4-byte real = 34.56 // this is the second number to be printed
V is 4-byte real = 100 // vertical position of the first line to be printed from top in mm


W = iTextWidth(iFont(4),NumtoString(N1,"6.2f")) //

von Jimbo - am 09.08.2009 06:22
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.