• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Formatting numbers and align the display

New Here ,
Jun 13, 2007 Jun 13, 2007

Copy link to clipboard

Copied

How do you line up number when using NumberFormat function.
ie. The following code displays a positive and a negative number that are both right justified:
xx33,456
(33,456)
(note: xx is used to demostrate spaces here, it does not show up in the output)

<tr><td align="right">#NumberFormat(33456,"(9,999)" )#</td></tr>
<tr><td align="right">#NumberFormat(-33456,"(9,999)" )#</td></tr>

As you can see both lines or numbers are flushed to the right and the numbers don't line up.

I need to have the numbers line up as follows:
x33,456
(33,456)

(again I used x as space here)

I can not use an extra space since the width of space is different than ')'
I tried adding "<font color=white>)</font>" ie. a white ')' at the end of positive numbers but that does not work either.

Any suggestions?

Thank you in advance.

ArtSooki@aol.com

TOPICS
Advanced techniques

Views

415

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 13, 2007 Jun 13, 2007

Copy link to clipboard

Copied

The concept code below is a bit torturous, but will probably get you what you're after. The idea is to place the right parenthesis in an adjoining column. You will need to place NumberFormat ( ) into the mix somewhere.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 13, 2007 Jun 13, 2007

Copy link to clipboard

Copied

Thank you very much for responding to my question.

Unfortunately CELLPADDING and/or CELLSPACING can not be 0 since it is a very complex reporting format.
If I set them to 0 then I have to add bunch of extra blank columns to compensate for that.
Any other suggestions?

I believe MS Word and Adobe writer have a tab or a formatting style specifically for this purpose.
Has anyone explored writing a custom tag or a script maybe to call adobe pdf API to utilize pdf writer's formatting capability?

I can't believe I am the first person requiring to do this.

Hopefully when we come up with an answer everyone can benefit.

Thanks again.

Looking forward to more respond, please!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 13, 2007 Jun 13, 2007

Copy link to clipboard

Copied

dear lord this isn't by any means pretty or elegant... but just to toss it out there as an option...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 13, 2007 Jun 13, 2007

Copy link to clipboard

Copied

LATEST
Use an empty image tag to position positive numbers instead of a space - play around with the exact width until it lines up correctly.

The example below places a 5 pixel blank image after positive numbers:

#NumberFormat(anyNumber,"(9,999)" )#<cfif anyNumber ge 0><img width="5" height="0"></cfif>

cheers.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 13, 2007 Jun 13, 2007

Copy link to clipboard

Copied

Use a negative sign instead of brackets to indicate negative numbers.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation