执行CmdDownload_Click事件时,如果生成的Excel行数超过10行左右时,
就会出现白屏,如何解决? Private Sub CmdDownload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Print.Click
Dim CPrint As New BLL.Quote.CQuotePrint, RefFileName As String = ""
Dim sSaveAsPath As String = ConfigurationSettings.AppSettings("BillSaveAsPath")
Dim RefMsg As String = ""
CPrint.CN = CType(Session(BLL.UserInfoConstant.SESSION_USER_CON_CN), ADODB.Connection)
RefMsg = CPrint.Print(txt_Quotenum.Text.Trim, RefFileName, Session(BLL.UserInfoConstant.SESSION_USER_INFO_DEFAULT_OWNTEL))
Dim CCommon As New Common.CommonClass
If RefMsg <> "" Then
CCommon.MsgBox(RefMsg, Me)
Exit Sub
Else
Response.Write("<script language=javascript>window.open('../DownLoad.aspx?frmFold=" + sSaveAsPath + "&frmQuote_file=" + RefFileName + "','DownLoad','height=100,width=400,top=100,left=100,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');</script>")
End If
End Sub
'''''''''''''''''''''''''''''''''''''''''''
'Download.aspx
''''''''''''''''''''''''''''''''''''''''''' Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'ÔÚ´Ë´¦·ÅÖóõʼ»¯Ò³µÄÓû§´úÂë
If Me.IsPostBack = False Then
DownLoadBill(Request("frmFold"), Request("frmQuote_file"))
End If
End Sub Private Sub DownLoadBill(ByVal PathName As String, ByVal FileName As String)
Dim name As String
Dim aFile As System.IO.FileInfo
Dim na As String
name = PathName + FileName
aFile = New System.IO.FileInfo(Server.MapPath(name))
na = System.IO.Path.GetFileName(name)
Response.Clear()
Response.ClearHeaders()
Response.BufferOutput = False
Response.ContentType = "application/octet-stream"
Response.AppendHeader("Content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, System.Text.Encoding.UTF8))
Response.AddHeader("Content-Length", aFile.Length.ToString())
Response.WriteFile(name)
Response.Flush()
Response.End()
End Sub
就会出现白屏,如何解决? Private Sub CmdDownload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Print.Click
Dim CPrint As New BLL.Quote.CQuotePrint, RefFileName As String = ""
Dim sSaveAsPath As String = ConfigurationSettings.AppSettings("BillSaveAsPath")
Dim RefMsg As String = ""
CPrint.CN = CType(Session(BLL.UserInfoConstant.SESSION_USER_CON_CN), ADODB.Connection)
RefMsg = CPrint.Print(txt_Quotenum.Text.Trim, RefFileName, Session(BLL.UserInfoConstant.SESSION_USER_INFO_DEFAULT_OWNTEL))
Dim CCommon As New Common.CommonClass
If RefMsg <> "" Then
CCommon.MsgBox(RefMsg, Me)
Exit Sub
Else
Response.Write("<script language=javascript>window.open('../DownLoad.aspx?frmFold=" + sSaveAsPath + "&frmQuote_file=" + RefFileName + "','DownLoad','height=100,width=400,top=100,left=100,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');</script>")
End If
End Sub
'''''''''''''''''''''''''''''''''''''''''''
'Download.aspx
''''''''''''''''''''''''''''''''''''''''''' Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'ÔÚ´Ë´¦·ÅÖóõʼ»¯Ò³µÄÓû§´úÂë
If Me.IsPostBack = False Then
DownLoadBill(Request("frmFold"), Request("frmQuote_file"))
End If
End Sub Private Sub DownLoadBill(ByVal PathName As String, ByVal FileName As String)
Dim name As String
Dim aFile As System.IO.FileInfo
Dim na As String
name = PathName + FileName
aFile = New System.IO.FileInfo(Server.MapPath(name))
na = System.IO.Path.GetFileName(name)
Response.Clear()
Response.ClearHeaders()
Response.BufferOutput = False
Response.ContentType = "application/octet-stream"
Response.AppendHeader("Content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, System.Text.Encoding.UTF8))
Response.AddHeader("Content-Length", aFile.Length.ToString())
Response.WriteFile(name)
Response.Flush()
Response.End()
End Sub
http://blog.csdn.net/ChengKing/archive/2005/11/29/539514.aspx