Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 28th, 2005, 04:15 PM
Registered User
 
Join Date: Oct 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to miaomiaoga Send a message via MSN to miaomiaoga
Default When I used "application/vnd.ms-excel" to export t

Hi,All,

Export Method:
-------------------------------------------------------------------------

strFileNameExport = "Results"

Response.Clear()
Response.Buffer = True
Response.ContentType ="application/vnd.ms-excel" 'application/msword
Response.Addheader "Content-Disposition", "attachment;Filename=" &
strFileNameExport & ".xls"
Response.Charset = "GB2312"
Response.Codepage = "936"

tblHeader = "<html><body><table border=1>"
tblFooter = "</table></body></html>"

Response.Write tblHeader & strContent & tblFooter
---------------------------------------------------------------------

I used this code to export the content of table to Excel File. But when i
opened the Excel file, sometime the words of the content would be showed as
"confused" words. But so strange the same table (same content), sometimes
would be "confused". And sometimes it would be showed normally. It's
randomly between "confused" words and normally words.

And I had tried to change all Charset and Codepage setting of all pages. But
same result.

Seems this problem not related with Charset and Codepage setting.


(All words showed "confused" is Chinese words. And english words all are
normally. Randomly showed this error sympton in Excel file.)

Environment: ASP,SQL2K,WIN2003.


--


Benny Ng



 
Old October 20th, 2007, 04:00 AM
Registered User
 
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Maybe, you should consider adding following

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

inside of <head> tags. Maybe you should try another codepage than utf-8. But this solved my problem.








Similar Threads
Thread Thread Starter Forum Replies Last Post
Export data to MS Excel in VB.NET DPARK0312 General .NET 1 December 9th, 2013 03:06 AM
"application/vnd.ms-excel" problem akeyworth Classic ASP Components 1 January 15th, 2008 01:09 PM
application/vnd.ms-excel Help! drumph Classic ASP Components 3 May 31st, 2007 06:02 AM
When I used "application/vnd.ms-excel" to export t miaomiaoga Classic ASP Databases 0 January 28th, 2005 04:12 PM
Using MS Excel in application justshahid VS.NET 2002/2003 2 January 13th, 2005 11:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.