Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a project in which we are exporting a page into excel using vbscript. I used the follwing code to export:

VB
Response.Buffer = True

       Response.ContentType = "application/ms-excel"
       Response.AddHeader("Content-Disposition", "attachment; filename=""" & filename & """")
       Response.ContentEncoding = System.Text.Encoding.UTF8

       Response.Charset = ""
       EnableViewState = False



Using this code the excel is downloading fine and data also fine, but when i select the cells which have numbers, its not showing the Sum and Average and all it only shows Count. I guess that the cells are in text format.

Since i am new to this, kindly tell me the Solution.

Thank You.
Posted

1 solution

Change the number format of cells as "General". This format automatically detects the format of input. And if it doesn't help, change it to "0" or in whatever format in you need the data to be.

Hope this helps!

Happy Coding :)
 
Share this answer
 
v2
Comments
ZJ1986 27-Nov-12 3:46am    
Thanks kumar for ur reply... I have tried this its not woking...
Sunny_Kumar_ 27-Nov-12 6:51am    
If you are generating the worksheet programmatically then share the code that you have tried so that I can track what exactly is going wrong. If you have a static file already created with you, then you can share a sample of that. Thanks.
ZJ1986 28-Nov-12 1:54am    
Data will be retrieve from the database based on the input(dropdown) in user interface. so the html table in site contains data. when we click the export button, the whole page wil be exported to excel by using the above code.
Sunny_Kumar_ 28-Nov-12 7:08am    
where is the code you're talking about?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900