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

Re: When I used "application/vnd.ms-excel" to export table's content to Excel file. It would be showed between "Confused" words and normally words randomly.How can i sloved it? by Peter

Peter
Sun Mar 13 07:19:42 CST 2005

Hi,

Try changing charset to utf-8.

Hope this help.
--
Regards,
Peter Jausovec
(http://blog.jausovec.net)
"Benny Ng" <benny_wufree@hotmail.com> je napisal v sporoèilo
news:exlrEKXBFHA.2640@TK2MSFTNGP14.phx.gbl ...
> 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
>
>