Decimal point alignment for numbers

edited 10:06PM in FastReport 3.0
Is it possible in FR3 to align on the decimal point, eg.
  10.12
   1.0001
   2
123.12

(or for that matter is it possible in v2.53), I've looked at various text alignment options but I haven't seen one.

Thanks in advance,
Azza

Comments

  • edited 10:06PM
    Any ideas anyone? Alex?
  • edited 10:06PM
    Use Format function, for example
    Format('%-5.2f', [1.23])
    will produce left-aligned number with two trailing spaces. 5 is whole width, 2 is number of digits after decimal point. Such string can be shown in the "Text" object with align=right and will look decimal point-aligned.
  • edited 10:06PM
    Thanks Alex but that isn't what I wanted!

    When there are numbers with no numbers after the decimal point (ie. 00) I don't want them displayed (see the number 2 in my original post).

    Also:
    a. certain items will have a different amount of decimal places, either none, 2 or 4.
    b. I don't want to use a fixed width font as it will look out-of-place with all other reports/fonts.
  • edited 10:06PM
    In this case you should use OnBeforePrint event of the "Text" object with a number. Event handler should form a string that contains a number and needed amount of spaces.
  • edited 10:06PM
    Thanks for reply but, again, as I stated:
    "b. I don't want to use a fixed width font..."
    to see what I mean:
    1. drop 2 text objects on the FR
    2. set both left value to same
    3. enter "1234.5678" in first text box
    4. enter "<3 spaces>0.123456" into second (obviously using space characters and not the text <3 spaces>!
    5. see the decimal point and the trailing numbers don't line up!!!

    So, as it looks like I can't align to decimal point, can I make a request to add this to the "wish list" (either FR2 or 3)?

    PS. Can you also add (to FR3 or the wish list) the <STRIKE>...</STRIKE> html tag to the HTML support to set the fsStrikeout Style of the Font.

    Thanks,
    Azza
  • gordkgordk St.Catherines On. Canada.
    edited 10:06PM
    Hi Azza
    you are talking about decimal align like a spreadsheet.
    here is how I work arround it currently in 2.5#
    but it would be nice to have in 3
    use 2 memos of a fixed size side by side right align the left memo left align the rightmemo.
    convertvalue of field to string copy the whole number portion to the left memo
    copy the decimalportion including decimal separator to rightmemo.
    regards ;)
  • edited 10:06PM
    Thanks, Gord.
    Just as I thought, a workaround. Looks like I'll have to stick to our existing solution. Hopefully Alex will include this in an early 3.0x version?!

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.