求:关于asp.net生成excel时候,直接点击打开然后再另存为时,excel的名字乱码的问题。重分!
Public Function OpenFile(ByVal PathName As String)
Try
Dim name As String = PathName
Dim aFile As FileInfo = New FileInfo(Server.MapPath(name))
Dim na As String = Path.GetFileName(name)
Response.Clear()
Response.ClearHeaders()
Response.BufferOutput = False
Response.ContentType = "application/octet-stream "
Response.AppendHeader( "Content-disposition ", "attachment;filename= " & HttpUtility.UrlEncode(na, System.Text.Encoding.UTF8))
Response.AddHeader( "Content-Length ", aFile.Length.ToString())
Response.TransmitFile( "c:\inetpub\wwwroot\ " + name)
Response.Flush()
Response.End()
Catch ex As Exception
Response.Redirect( "filedownload.aspx ")
End Try
End Function
点击生成报表时,调用的是这个函数。如果保存之后在打开就正常。可是直接点击打开然后再另存为时,excel的名字乱码,请问是什么问题?怎样修改?谢谢。
------解决方案--------------------excel打开时没有进行解码.
------解决方案--------------------帮顶 !
------解决方案-------------------- http://www.cnblogs.com/wf5360308/articles/621401.html