Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to start a value be printed at a particular column number.

Status
Not open for further replies.

crystal28

Programmer
Oct 23, 2002
108
0
0
US
In a line of Text,how to start a value be printed at a particular column number.
Lets say i have a formula in which i am concatanating 3 strings and i want the 3rd string to start printing at column 70,how to do this.
I know replicatestring will add n number of strings but i would like to print exactly at a particular column
 
I think you'd need to place it in its own field.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Difficult to space strings precisely as most fonts do not allocate space equally to each character.

YOu could introdce a tab into your concatenation.

(StrinG1) &" "& (String2) & chrw(9)& (String3)

Adding more & chrw(9)& will introduce more tabs.

Ian

 
Ian

Well using a tab or adding strings is going to create problem if the data value changes for one of the fields,if lets say StringG in your example has 2 characters then the string3 that i want to print will print in lets say 70th column,but if string1 changes to 3 digits then it will create problem,that is why i want a way.i cant add it as a different field it needs to be the same field or else i wouldve added it..
 
Ok then use a stringvar

Change your concat formula

global stringvar adStr:= ' fill with 70 spaces ';
global numbervar strlen;

strlen:= length(string1) + length(string2)

(StrinG1) &" "& (String2) & left(adstr, (70-strlrn-1)) &(String3)

The extra -1 accounts for the space between str1 and 2


However, as mentioned earlier most fonts do not give equal spacing for all characters, you will have to use something like Courier for this to work.

Ian




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top