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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can we manipulate 'Chars per inch" in code?

Status
Not open for further replies.

PavanKumarU

Programmer
Jan 31, 2003
56
US
Hi,
Got an additional question to my earlier one.
Can we specify this 'characters per inch' in code?
I am trying to export this report to a text file through VB also. Can i specify a setting in code to reflect no. of characters per inch?
any help is much appreciated.
Thanks,
Pavan
 
If you're using Windows fonts, it doesn't work that way as they are proportional fonts (chars have different widths).

As for an export to text, the old rule of thumb was 10 chars per inch, but again, if you open it in a Word Doc, you may get wrap around.

Why would you be concerned with chars per inch in a text file?

-k
 
hi,
Thanks for the message. We are concerned abt it coz, we need to export each field with some fixed length. Lets say we export name, address, country and zip. Name shld be 30 chars. If the data we get is only 15, then the other 15 sld be spaces. And most importantly, this shld how it shld look in any editor....in notepad, in ultraedit, in MSword etc.
Unfortunately in Crystal we cant specify how many 'characters' it should display for a field.
Any ideas?
Thanks,
Pavan
 
Fixed length has nothing to do with chars per inch, chars per inch is a printing reference to the number of chars that are shown for every inch, I had thought that this might be the case.

What you want to do is pad each field when required, or truncate the field if it's too long.

So each field becomes a formula of type text (meaning you'll likely use the totext() function on non string type fields), here's an example for a length 15 padded with spaces in front:

If Length({YourField}) < 15 then
{YourField} + Space(14 - length({YourField}))
else
left({YourField},15)

-k
 
Hi,
Thanks for the message. But actually, when it writes to the text file, I need those spaces. But, I am not getting them when i use your method. Any more ideas?
Thanks,
Pavan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top