Link to home
Start Free TrialLog in
Avatar of FalveyCF
FalveyCF

asked on

coldfusion, How to enter zipcodes into an excel spreadsheet without having the leading zero being dropped. Is it possible to change the category of the column in coldfusion?

I'm using coldfusion to create an excel spreadsheet. How do I enter zipcodes into that spreadsheet without having the leading zero being dropped. Is it possible to change the category of the column from number to zip code or text in coldfusion?

To get around this I was entering " " before the zip code to allow for the leading zero to be displayed; however, the end user doesn't like the space being there. So I need to find another way to enter a zip with the leading zero still there.
ASKER CERTIFIED SOLUTION
Avatar of SidFishes
SidFishes
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello FalveyCF,

SidFishes gave you an excellent alternative, which basically uses number formatting to force Excel to treat
the value as text (an thus retain leading zeroes).  Another way would have been to prepend a single-quote
to the zip code, which again forces Excel to treat the entry as text.

If you want to keep the entry as a number but still *display* leading zeroes, the format string in Excel would
be:
[<10000]00000;[>=10000]00000-0000

That keeps the entries as numbers, but displays a traditional zip code or zip+4.  No idea how to pass that
format string in ColdFusion, though...

Regards,

Patrick
Avatar of FalveyCF
FalveyCF

ASKER

Thank you very much! It worked perfectly!