1
点击更新面板中的按钮即可生成Excel文件。它抛出一个解析错误。请参阅下面的代码。响应对象没有在更新面板中返回Excel流?
如果我将按钮保持在更新面板之外,它工作正常。为什么它不在更新面板中工作?
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition",
String.Format("attachment;filename={0}", filename))
Response.Clear()
Response.BinaryWrite(WriteToStream.GetBuffer)
HttpContext.Current.ApplicationInstance.CompleteRequest()
Private Function WriteToStream() As MemoryStream
'Write the stream data of workbook to the root directory
Dim file As MemoryStream = New MemoryStream
hssfworkbook.Write(file)
Return file
End Function
谢谢你这么多..它为我工作。 – James123 2010-10-12 04:08:00