Decimal Align Column

Is there an easy way to decimal align a column?

I have a column of numbers that have a variable number of decimal places. How can I get their decimals all to align.

12.1
132.22
12.234
11.8
888.1

I am using Arial 10pt font and padding with spaces is not working to line up.

Comments

  • edited May 2012
    Is there an easy way to decimal align a column?

    I have a column of numbers that have a variable number of decimal places. How can I get their decimals all to align.

    12.1
    132.22
    12.234
    11.8
    888.1

    I am using Arial 10pt font and padding with spaces is not working to line up.
    I think the only way to do that is to pad/format the output and use a fixed pitch font, Lucida Console, Courier, System.
  • edited 5:40AM
    technisoft wrote: »
    I think the only way to do that is to pad/format the output and use a fixed pitch font, Lucida Console, Courier, System.

    I was afraid of that. It is such a basic function to most reports. But such a pain to have to code for each instance.
  • keturpatelketurpatel India
    edited 5:40AM
    can you clarify more your question? How you want your numbers to display?

    I think various options of memo view -> display format will help you.

    e.g. : To show right aligned numbers, use hAlign 'Right', display format category 'Number' and format '%3.3f'
    It will display result as -

    12.100
    132.220
    12.234
    11.800
    888.100
  • edited 5:40AM
    keturpatel wrote: »
    can you clarify more your question? How you want your numbers to display?

    I think various options of memo view -> display format will help you.

    e.g. : To show right aligned numbers, use hAlign 'Right', display format category 'Number' and format '%3.3f'
    It will display result as -

    12.100
    132.220
    12.234
    11.800
    888.100

    My issue is that I have numbers that have varying decimal places based on the category of the test data. And I am trying to use the Arial font so that all numbers have the same look. I am setting the format text in the before print event. I cannot have trailing zeros beyond the expected accuracy of the original data. In I have not found a way to pad it accurately as the zero character is not the same width as a space. See my example data above and the attached image of how OpenOffice Writer handles a decimal tabstop.
    i-q7TJmsw.jpg
  • gpigpi
    edited 5:40AM
    Use two TfrxMemoView - first for truncated numbers, second - for decimals
  • keturpatelketurpatel India
    edited 5:40AM
    Only solution for your problem is to use font which uses same space for each character and pad it with space.

    There are several fonts which you can use.
    my suggestion is courier new font. other fonts are sans serif, draft and roman fonts.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.