Align and format numbers

Use proper containers and properties to align and format numbers.

Use the ToolBox object Decimal Format Box as the report element for numbers. It supports different locales and kinds of numbers, including integers, fixed-point numbers, and currency amounts ($123).

The text property specifies the value for the number to be printed. The value of this property may also be edited directly in the report design document by double-clicking the Decimal Format Box. The input cursor will be placed in the document, and the layout of the document is updated on each keystroke.

The format property specifies how the number will print out. The default value for this property is "---,---,---&.&&". You can change this string, using the specified symbols. The - (minus) symbol represent digits (if the number is negative, it will print with a leading - ), and the period represents the decimal point. The & symbol fills with zeros any position that would otherwise be blank. If the actual number displayed requires fewer characters than the format string specifies, numbers are right-aligned and padded on the left with blanks.

The alignment property specifies how the number is aligned, for example, baseline or centered. It controls the x position of this report element in its parent container, unless you have set the x property explicitly.

Table 1. Formatting examples
Value of text property Appearance in report
123456.1 123,456.10
15.24 15.24
-1600 -1,600.00