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

  • Thread starter Thread starter Benny Ng
  • Start date Start date
B

Benny Ng

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