“How do you know how big to make a field in Crystal Reports?”

Laying out a Crystal Report can be stressful, especially when you’re guessing at how wide to make a field so string data fits.  The problem is, string database fields (such as nvarchar) are measured in characters, but text felds are measured in inches or centimeters.  You could guess at the field width, run the report, see if everything fits, and keep adjusting and running until the entire database field fits the field on your report.

Or you can be smart.

Open your database (or database schema, whatever you are using), and see the maximum length of the data field.  Let’s say we have a varchar(50).  We know the maximum number of characters is 50.  On your report, add a Text Object, and make it kind of wide.  Type in 50 M’s (like this: MMMMMMMMMM…).  Resize the text object until all the M’s are visible.  Drag the database field onto your report, and make it the same width as the 50 M text object.  That is the maximum width your database field will be.

In proportional fonts (such as Times New Roman or Verdana), the uppercase M is typically the widest letter (in monospaced fonts like Courier New, all the letters are the same width).  Using the letter M is an old typesetter trick, and carries over into today’s world.  If you have ever used CSS, and set a font size to ‘1 em’, the ’em’ unit is equivalent to the width of the M in that font face (this is different than the <EM> tag, which italicizes the text).  The ’em’ unit does not have a definite width (such as a cm or in), but is a relative width in each font based on that font’s specification.