Solved

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
3
578 Views
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.
0
Comment
Question by:FalveyCF
[X]
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
3 Comments
 
LVL 36

Accepted Solution

by:
SidFishes earned 250 total points
ID: 22651402
when you do the export use mso-number-format for text

ie:

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

Author Closing Comment

by:FalveyCF
ID: 31503436
Thank you very much! It worked perfectly!
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
: Microsoft Office Collaborate for free and online versions of Microsoft  Word, Excel, Powerpoint, OneNote, Onedrive , Email, Calendar etc. In short we can say that Microsoft office is a suite of servers, applications and services developed by  Micr…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

628 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