BOFocus – Crystal Reports Tips – Tricks – Tutorials

Crystal Reports - Formulas

Add Padding to a field

At times in may be necessary to add padding to a field. Some examples would be an export from Crystal Reports to Excel or a CSV file for importing the data from one system to another. Below are two examples on how to accomplish this task.

Example #1:

Fields needs to be 14 characters with spaces to the left:

Numbervar a:= Length(Trim({Credit.Credit Authorization Number}));
Space(14 – Numbervar a) & Trim({Credit.Credit Authorization Number});

Example #2:

Field needs to be 14 charters with ‘0’s filling in any blank charters to the right:

Stringvar a := {Credit.Credit Authorization Number} + “00000000000000″;
a [1 to 14]

Tagged ,

One thought on “Add Padding to a field

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



You can easily apply font changes to textboxes or fields by simply clicking on them once and selecting the desired font format from the icon menu.