Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Display Of A Long Number 1

Status
Not open for further replies.

Skittle

ISP
Sep 10, 2002
1,528
0
0
US
I have an ASP page that displays a table.
The table has many columns and rows.
One of the columns shows a 14 character ( numeric only ) part number. When I output the table as an Excel document in a browser, the number is displayed as abreviated real number eg. 6E+11. How can I tell Excel this is a character field in the browser? I have tried concatonating a single ' character to the beginning of the cell value but although the number is treated as text, the ' character is visable in the Excel sheet.

Anybody any ideas how I can get the number displayed as text without the ' character in Excel within my browser?
 
Hmm doesn't work for me.
I tried :-

FormatNumber(objRS01("ODITEM"),0,0,0,0)

but I still get the ',' characters breaking up the number.
So instead of 12345678901234 I get 1,234,567,891,234.

 
Ignore my previous post.
The number is displayed as 12345678901234 in html but in Excel it still gets displayed as 6E+11.

 
In the class definition for that cell, use, e.g.:
Code:
.x124
   {mso-style-parent:style0;
   mso-number-format:0;}
Then in the cell, use:
Code:
<td height=17 class=x124 align=right width=135 style='height:12.75pt; width:101pt' x:num=&quot;12345678901234&quot;>12345678901234</td>

This was generated by 1) formatting the cell properly in Excel, 2) saving as a web page, and 3) examining the generated html. This is how I generally format Excel reports, by making up a dummy then generating the pre-formatted html dynamically.
 
Thanks for the help. I could use a bit more of an
explanation.


I don't understand the purpose of the two occurrances of the number in the cell. Is it because the 'X:Num' version is only displayed in the Excel file while the other is displayed in the html version?

How can I find the parameters I can use that begin with 'mso'? I presume 'mso' means 'microsoft office'?
 
dmhirsch is right.
Exporting an Excel file or an Document file will make some classes and tags that are recognized only by same application or some who can read the file.
Those tags and properties are there only to preserve the original format and same time to be accesible to any browser.
To simplify this.
When saving an excel file as html you will lose all the text,number, coloring formating of the file if excel doesnt do that. So in order to keep you number as General Number not Scientific excel will make an style (x124) and will set this style there and adds few properties that will store some more info. Internet Explorer knws how to display those formats same as Excel who imports/opens that file again. You will see same file as original even if it's not excel.
To anyother browser you will see almost same visual copy of that file and nothing more.

So in order to keep some Excel formating to your html Output you have to use Excel styles.
That dmhirsch showed you.

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top