当渲染模式选择ViewerType="HtmlViewer"时,点击[Search]检索出报表后,再点[Excel]导出,会出现”报表不可用”的提示,之后导出正常
不点[Search],直接导出则正常
渲染模式选择ViewerType="RAWHtml"也正常
是BUG吗
开发的系统中报表使用折叠效果,必须使用HtmlViewer模式,怎么才能不显示”报表不可用”的提示 前台代码:
<ActiveReportsWeb:WebViewer ID="WebViewer1" runat="server" Height="1000" Width="700" ViewerType="HtmlViewer"></ActiveReportsWeb:WebViewer>
后台代码:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
''' <summary>
''' 查询
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Protected Sub btnQuery_Click(sender As Object, e As EventArgs) Handles btnQuery.Click
Dim rpt As GrapeCity.ActiveReports.PageReport = New GrapeCity.ActiveReports.PageReport(New System.IO.FileInfo(Server.MapPath("DataReport.rdlx")))
AddHandler rpt.Document.LocateDataSource, AddressOf Me.runtime_LocateDataSource
Me.WebViewer1.Report = rpt
End Sub
''' <summary>
''' 导出
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Protected Sub BtExcel_Click(sender As Object, e As EventArgs) Handles BtExcel.Click
'Provide the page report you want to render.
Dim _reportDef As New GrapeCity.ActiveReports.PageReport(New System.IO.FileInfo(Server.MapPath("RdlReportTest.rdlx"))) 'DataReportExcel.rdlx
Dim _reportRuntime As New GrapeCity.ActiveReports.Document.PageDocument(_reportDef)
'AddHandler _reportRuntime.LocateDataSource, AddressOf Me.runtime_LocateDataSource
Dim ms As New System.IO.MemoryStream()
' Provide settings for your rendering output.
Dim excelSetting As New GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings()
excelSetting.FileFormat = GrapeCity.ActiveReports.Export.Excel.Page.FileFormat.Xls
excelSetting.MultiSheet = False
Dim setting As GrapeCity.ActiveReports.Extensibility.Rendering.ISettings = excelSetting
'Set the rendering extension and render the report.
Dim excelRenderingExtension As New GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension()
Dim outputProvider As New GrapeCity.ActiveReports.Rendering.IO.MemoryStreamProvider()
_reportRuntime.Render(excelRenderingExtension, outputProvider, excelSetting.GetSettings())
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition", "inline;filename=ActiveReport" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls")
outputProvider.GetPrimaryStream().OpenStream().CopyTo(ms)
Response.BinaryWrite(ms.ToArray())
'Response.End();
Context.ApplicationInstance.CompleteRequest()
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
End Sub
Demo已经发到你们邮箱中
|