473,516 Members | 3,465 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

exporting webpage to excel formatting problem

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
3 9521
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1974
by: George G. | last post by:
I am exporting a report to an Excel file. Whatever options I use for the formatting the results remain the same. I have set the ExcelTabHasColumnHeadings to true and false without any difference. I have set the ExcelUseConstantColumnWidth to true and thenset the width to different values and have seen no changes. The code I am using is shown...
4
3931
by: D | last post by:
I've created a report with many subreports of aggregate data. I want my client to be able to export this data to Excel to make her charts, etc. Only one problem: one of the fields is a "SchoolYear" TEXT field that contains data such as 2000/01, 2001/02, etc. If I export a Query with this kind of data to Excel, it gives me the text value of...
2
1337
by: wojtekW | last post by:
I would like to export a result of query to Excel sheet. Mayby somebody from you know how to do this? Thanks Wojciech Wasikiewicz
0
1332
by: Mike P | last post by:
I'm exporting a datagrid to excel, but I can't get non-English characters such as ö, ä and å to appear properly in the Excel document (they are fine on my webpage). Here is my code : Response.Clear(); Response.Buffer = true; Response.ContentType = "application/vnd.ms-excel"; Response.Charset = "iso-8859-1"; this.EnableViewState = false;
1
3146
by: Mustufa Baig | last post by:
I have an ASP.NET website where I am showing off crystal reports to users by exporting them to pdf format. Following is the code: ---------------- 1 Private Sub ExportReport() 2 Dim oStream As System.IO.MemoryStream = 3 myReport.ExportToStream( ExportFormatType.PortableDocFormat) 4 Response.Clear() 5 ...
1
2611
by: mark.heyden | last post by:
Hi Frends, I am facing problems while trying to export data into pipe format. In fact I am fetching records from mysql database and then trying to create a text file ( using pipe as delimeter) , intending to open in Excel. The data is been inserted from textarea fields, where the user can write text and may press enter key to format his...
5
4162
by: =?Utf-8?B?c2NobWlkdGU=?= | last post by:
Hi How can I Export an HTML Table to excel? My goal is a button, and when the user clicks this button a popup appears asking the user to 'open' or 'save' the generated Excel file. Actually I'm exporting by rendering my table to an htmlwriter and sending this to excel. This is working nearly perfect. There's a problem with Excel's...
1
1543
7 of 9
by: 7 of 9 | last post by:
Ok here is the situation: I have an Autoexec macro that does the following in order 1) Runs a set of queries(1-9) 2) Exports the final query to excel 3) Does some formatting (subtotals etc) 4) Saves the changes in excel 5) Emails the excel file The problem is that when it saves the changes in excel (4) the process stops because excel warns...
2
19267
by: atlbearcat | last post by:
Here's one that's been bugging me for about a week now... I have a form that allows users to filter records, simple enough. But I want to give them the option to export the filtered records to Excel. I don't want to use the docmd.outputTo due to it won't filter the records, it puts all of the records in the file. I've looked around and found...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7547
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5106
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3252
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1620
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.