printing custom report

robbie_62

Newcomer
Joined
Jan 27, 2003
Messages
18
Location
ireland
hi im using the print method in vb.net to pring out a simple report of my access db.

In my table i have simple data for now,
first name
surname
address 1
address 2
address 3
address 4

now,i want to print these like :

Name Address
tom jones address1,etc,etc,etc
mary smith address1,etc,etc,etc

the names and address are all different lenghts so they are not aligned properly and look like this :

Name Address
tom jones address1,etc,etc,etc
mary smith address1,etc,etc,etc

I made a routine to test the length of the name,if it is less than 25 chars then to go into a loop and pad the end of the string with spaces until it becomes 25 chars long.

I do the same with the address fields only i want it to be 46 chars long.

When i do this and print it out the spaces are different.

If i replace the added space with a number for example it shows up aligned ok :

Name Address
tom jones (25 chars) address1,etc,etc,etc
mary smith (25 chars) address1,etc,etc,etc

Name Address
tom jones0000000000000address1,etc,etc,etc
mary smith000000000000address1,etc,etc,etc

does the print method treat the space character differently ?

should i check the name field for 25 spaces before i save it to the db and pad it with spaces then ??

any ideas wud be greatly appreciated
 
If you intent to save the name field in a padded format in Access use trim on it to get the length less space to caculate how many you need to add.

I haven't looked at the CR detail yet, but have you checked to see if there is an option to auto size the fields on the report?
 
When you are printing out each each of data from the fields in your database, why not just set a margin equal to the space you ant.

For example:
concatenate the firstname and surname
then
<vb>
e.Graphics.DrawString(fullname, FontA, Brushes.DarkBlue, X1, y)
e.Graphics.DrawString(address1, FontA, Brushes.DarkBlue, X2, y)
e.Graphics.DrawString(address2, FontA, Brushes.DarkBlue, X3,y)
</vb>
etc...
where x2 = x1+ somenumber , x3=x2 + someothernumber...

I hope this helps.
 
Back
Top