472,351 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,351 software developers and data experts.

leading zero's for excel content

Hi
I use reponse.contenttype = "application/vnd.ms-excel"
So the browser will show the data in excel format, but for
some fields I use leading zero's, which truncated by the
browser, at this content type.
If I concat a "'", or other none numeric char, the problem
is solved inconsistently!!!
But even this solution is problematic - is there any
solutions, explanation?

Jul 19 '05 #1
3 16215
If Excel sees a number, it's going to drop leading zeros, because they're
meaningless. If you are trying to represent a number as a string, then
treat it as a string (prefix with ' )... why is this problem "solved
inconsistently" or "problematic"?

"yanir" <ya*****@hotmail.com> wrote in message
news:04****************************@phx.gbl...
Hi
I use reponse.contenttype = "application/vnd.ms-excel"
So the browser will show the data in excel format, but for
some fields I use leading zero's, which truncated by the
browser, at this content type.
If I concat a "'", or other none numeric char, the problem
is solved inconsistently!!!
But even this solution is problematic - is there any
solutions, explanation?

Jul 19 '05 #2
"yanir" wrote:

I use reponse.contenttype = "application/vnd.ms-excel"
So the browser will show the data in excel format, but for
some fields I use leading zero's, which truncated by the
browser, at this content type.
If I concat a "'", or other none numeric char, the problem
is solved inconsistently!!!
But even this solution is problematic - is there any
solutions, explanation?


One solution is to put a non-breaking space (&nbsp;) in the cell. This
instructs Excel to treat the data as text. You can also use specific style
attributes that Excel recognizes, such as mso-number-format. This example
imposes a 5-digit mask on the numeric cell contents:

<TD STYLE="mso-number-format:00000">

I have no idea where this is documented. I reverse-engineered by saving an
Excel spreadsheet as HTML and reading source code.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #3
You helped me a lot, thanks
-----Original Message-----
I've found when you use the ' like this, you'll wind up seeing the ' in thecell - pretty irritating. You may be able to do:

<td>=TEXT(<%=YourNumber%>,"<%=String(Len (YourNumber), "0")%>")</td>
to produce
<td>=TEXT(0001,"0000")</td>

Ray at work

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in messagenews:eJ**************@TK2MSFTNGP10.phx.gbl...
If Excel sees a number, it's going to drop leading zeros, because they're meaningless. If you are trying to represent a number as a string, then treat it as a string (prefix with ' )... why is this problem "solved inconsistently" or "problematic"?

"yanir" <ya*****@hotmail.com> wrote in message
news:04****************************@phx.gbl...
> Hi
> I use reponse.contenttype = "application/vnd.ms-excel"
> So the browser will show the data in excel format, but for > some fields I use leading zero's, which truncated by the > browser, at this content type.
> If I concat a "'", or other none numeric char, the problem > is solved inconsistently!!!
> But even this solution is problematic - is there any
> solutions, explanation?
>


.

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: LRW | last post by:
This may be a question more directed to Excel, but I'm using PHP to generate a CSV to be imported into Excel, so maybe the solution is there. So,...
1
by: Jawahar Rajan | last post by:
All, I am using the ASP code below to save some data from a SQL Server database via ADO as an Excel spreadsheet strReportName =...
5
by: Tlm | last post by:
Hello All, I'm importing Contact data from a Excel spreadsheet into an Access table. No problem there. However, here in Massachusetts our zip...
1
by: mmmgood1 | last post by:
Help, I'm linking an excel spreadsheet in access and I have datafields with leading zeros (01021). When the file is linked in access, I get a...
6
by: Kevin Humphreys | last post by:
Hi There, I am trying to export a recordset to an excel file using the Content Type below in the header. Response.ContentType =...
3
by: Matt Pegg | last post by:
Hi all, I'm trying to generate a simple Excel spreadsheet via ASP but I'm running in to trouble. Here's the code: <% response.AddHeader...
6
by: JimmyKoolPantz | last post by:
Task: Customer wants a script of the data that was processed in a "CSV" file. Problem: Zip-Code leading zeros are dropped Basically we have...
5
by: Reggie | last post by:
Hi and TIA! I have an export procedure that exports my data from my datagrids to excel. The problem is that I lose leading zero's cause excel...
7
benchpolo
by: benchpolo | last post by:
I have an excel spreadsheet (.csv) format of list of zipcodes that I am trying to import to my custom table zipcodes.. I having issue in importing a...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.