When I used "application/vnd.ms-excel" to export table's content to Excel file. It wo

miaomiaoga

Newcomer
Joined
Jan 28, 2005
Messages
7
When I used "application/vnd.ms-excel" to export table's content to Excel file. It wo

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
 
Back
Top