Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 612
  • Last Modified:

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.
1 Solution
when you do the export use mso-number-format for text


<cfheader name="Content-Disposition" value="filename=test.xls">
<cfcontent type="application/">
<tr><td style="mso-number-format:\@">
Patrick MatthewsCommented:
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

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...


FalveyCFAuthor Commented:
Thank you very much! It worked perfectly!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now