Font Character Spacing in a Report (1 Viewer)

ted.martin

Registered User.
Local time
Today, 02:24
Joined
Sep 24, 2004
Messages
743
Is there a way to space out the text characters in a report text box so that I am able to print each letter onto a given template document designed with a box for each letter. This weblink below seems to be the answer but I cannot make it work.

Many thanks in anticipation
 

CJ_London

Super Moderator
Staff member
Local time
Today, 03:24
Joined
Feb 19, 2013
Messages
16,607
in what way can you not make it work?
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:24
Joined
Feb 19, 2002
Messages
43,263
Choose a non-proportional font and decide how many spaces you need between the letters by testing or measuring.
 

ted.martin

Registered User.
Local time
Today, 02:24
Joined
Sep 24, 2004
Messages
743
in what way can you not make it work?
I have copied the code into the modules as suggested putting a single text box control in the Detail section of the Report and linked it to a table. The report runs but the printed text is normal. I have zipped and attached the CStest db.. If you would like to take a look that would be fantastic.
 

Attachments

  • CStest.zip
    94 KB · Views: 303

ted.martin

Registered User.
Local time
Today, 02:24
Joined
Sep 24, 2004
Messages
743
Choose a non-proportional font and decide how many spaces you need between the letters by testing or measuring.
Thank you Pat but I think it is about a space and a half. The code link I posted allows the gap to be measured in centimetres so for the time being, I prefer that route. I hope your colleague CJ_London has some thoughts.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:24
Joined
Feb 19, 2002
Messages
43,263
You might be able to change the point size. Try different fonts. They are actually different sizes even for the same point number. I wish it were easier to tell which ones are non-proportional. Maybe Google knows, except I haven't used Google for years. I use Duckduckgo. I get far better results.
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 22:24
Joined
May 21, 2018
Messages
8,527
@isladogs may be able to help. If I was going to do this in my head I would
1. Use the on print event.
2. Pass in the control width
3. Get the number of characters
4. Get the font
5. Get the points
Look at the conversions in the code here from @isladogs
6. Determine how many characters will fit
7. Reduce size to fit.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 03:24
Joined
Feb 19, 2013
Messages
16,607
Worked for me - just need to follow the instructions - detail section needs to be 10cm high

1611617708754.png
 

ted.martin

Registered User.
Local time
Today, 02:24
Joined
Sep 24, 2004
Messages
743
Thank you CJ_London. I did not have the Detail section 10cm high.
 

isladogs

MVP / VIP
Local time
Today, 03:24
Joined
Jan 14, 2017
Messages
18,216
This all seems unnecessary to me. Just set text align property to Distribute.
1611651034617.png
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:24
Joined
May 7, 2009
Messages
19,233

Attachments

  • CStest.zip
    93 KB · Views: 176

ted.martin

Registered User.
Local time
Today, 02:24
Joined
Sep 24, 2004
Messages
743
Yes, arnelgp. The boxes are pre-printed on the template form that I have to fill in.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:24
Joined
May 7, 2009
Messages
19,233
This is much close?
 

Attachments

  • CStest.zip
    91 KB · Views: 222

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 03:24
Joined
Sep 12, 2006
Messages
15,652
if you have a box for each letter, why not put each letter in a control of its own. Then you can use any font.
 

ted.martin

Registered User.
Local time
Today, 02:24
Joined
Sep 24, 2004
Messages
743
if you have a box for each letter, why not put each letter in a control of its own. Then you can use any font.
Yes I thought of that but putting on over 100 controls by 6 forms would have driven me crazy. Thank you anyway.
 

ted.martin

Registered User.
Local time
Today, 02:24
Joined
Sep 24, 2004
Messages
743
SOLVED - the code from MSDN finally worked.
Attached is the Test db and Scan of the result.
Thank you everyone; we got there in the end.
 

Attachments

  • GOS 6 new.pdf
    301.8 KB · Views: 374
  • CS2.zip
    36.5 KB · Views: 290

ted.martin

Registered User.
Local time
Today, 02:24
Joined
Sep 24, 2004
Messages
743
This is much close?
Thank you. I wanted to avoid having to put 100 + controls on each report hence I wanted to try and find a code solution. Limiting to a non-Proportional font like Lucida Console is not a problem. (see the final solution in my posts at the end). Thank you for your help.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:24
Joined
May 7, 2009
Messages
19,233
so you are using a pre-printed form?
sometimes they are not "printed" with same margins", so once in a while
you will need to adjust your report.

but if you create your own report, using the GOS 6 pdf (coverted to png or bmp)
and use the technique i showed you, your textbox are always align with the boxes.

see this: (limit of control in report is 754).
Access specifications - Access (microsoft.com)
 

Users who are viewing this thread

Top Bottom