By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

exporting webpage to excel formatting problem

P: n/a
Hi, I have a webpage that is taking input from a form and using it as
criteria to select data out of an sql database. The page displays an
html table with the results. The user can then click a button "excel"
to open or save the file as an excel document. This works, and
everything in the excel document is formatted fine except for the
first column which in this case is "Part Number". The problem is that
this part number: 883100105100 is displayed like this: 8.831E+11 in
excel. I am not sure how to format the excel cells using the asp/html
so that it doesn't try to throw everything into scientific notation.
I have thought that maybe if I gave excel a string value instead of a
number value then it would fix the problem but I am pretty new to asp
and am not sure how to do this. Below is the block that throws
everything into excel in the first place. Any help would be great,
thank you!

<%
'Change HTML header to specify Excel's MIME content type

Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
%>
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Precede the values with a ' character, like, instead of 883100105100, make
it so it's '883100105100.

Ray at home

--
Will trade ASP help for SQL Server help
"Jeremy" <ok********@hotmail.com> wrote in message
news:3a**************************@posting.google.c om...
Hi, I have a webpage that is taking input from a form and using it as
criteria to select data out of an sql database. The page displays an
html table with the results. The user can then click a button "excel"
to open or save the file as an excel document. This works, and
everything in the excel document is formatted fine except for the
first column which in this case is "Part Number". The problem is that
this part number: 883100105100 is displayed like this: 8.831E+11 in
excel. I am not sure how to format the excel cells using the asp/html
so that it doesn't try to throw everything into scientific notation.
I have thought that maybe if I gave excel a string value instead of a
number value then it would fix the problem but I am pretty new to asp
and am not sure how to do this. Below is the block that throws
everything into excel in the first place. Any help would be great,
thank you!

<%
'Change HTML header to specify Excel's MIME content type

Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
%>

Jul 19 '05 #2

P: n/a
If you have XL2k or greater, format a few cells on a worksheet as text,
select them, and save the selection as HTML.

This will help you construct a style sheet to format the cells

eg:

<style>
<!--table
..xlText {mso-number-format:"\@";}
-->
</style>
Then use

<td class="xlText">883100105100</td>
Tim.

"Jeremy" <ok********@hotmail.com> wrote in message
news:3a**************************@posting.google.c om...
Hi, I have a webpage that is taking input from a form and using it as
criteria to select data out of an sql database. The page displays an
html table with the results. The user can then click a button "excel"
to open or save the file as an excel document. This works, and
everything in the excel document is formatted fine except for the
first column which in this case is "Part Number". The problem is that
this part number: 883100105100 is displayed like this: 8.831E+11 in
excel. I am not sure how to format the excel cells using the asp/html
so that it doesn't try to throw everything into scientific notation.
I have thought that maybe if I gave excel a string value instead of a
number value then it would fix the problem but I am pretty new to asp
and am not sure how to do this. Below is the block that throws
everything into excel in the first place. Any help would be great,
thank you!

<%
'Change HTML header to specify Excel's MIME content type

Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
%>

Jul 19 '05 #3

P: n/a
Hi Ray, thanks for the suggestion, but it didn't work. . it no longer
displays the number in scientific notation but now it displays it like
this: '883100105100 . . .it doesn't hide the apostrophe. Though the
strange thing is, once I'm in excel if I delete the apostrophe and
type it in myself, then it hides it. I guess excel doesn't like
apostrophe's from html :-)

Thanks Again,

Jeremy
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message news:<Oz**************@TK2MSFTNGP10.phx.gbl>...
Precede the values with a ' character, like, instead of 883100105100, make
it so it's '883100105100.

Ray at home

--
Will trade ASP help for SQL Server help
"Jeremy" <ok********@hotmail.com> wrote in message
news:3a**************************@posting.google.c om...
Hi, I have a webpage that is taking input from a form and using it as
criteria to select data out of an sql database. The page displays an
html table with the results. The user can then click a button "excel"
to open or save the file as an excel document. This works, and
everything in the excel document is formatted fine except for the
first column which in this case is "Part Number". The problem is that
this part number: 883100105100 is displayed like this: 8.831E+11 in
excel. I am not sure how to format the excel cells using the asp/html
so that it doesn't try to throw everything into scientific notation.
I have thought that maybe if I gave excel a string value instead of a
number value then it would fix the problem but I am pretty new to asp
and am not sure how to do this. Below is the block that throws
everything into excel in the first place. Any help would be great,
thank you!

<%
'Change HTML header to specify Excel's MIME content type

Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
%>

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.