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

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top