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?

Posted on 2008-10-06
Last Modified: 2013-12-16
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.
Question by:FalveyCF
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 36

Accepted Solution

SidFishes earned 250 total points
ID: 22651402
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:\@">
LVL 92

Expert Comment

by:Patrick Matthews
ID: 22651627
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...



Author Closing Comment

ID: 31503436
Thank you very much! It worked perfectly!

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: : Open Page or Post…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question