-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReportOutput.aspx.vb
More file actions
58 lines (51 loc) · 1.73 KB
/
ReportOutput.aspx.vb
File metadata and controls
58 lines (51 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.IO
Imports DevExpress.XtraReports.UI
Partial Public Class ReportOutput
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim report As XtraReport = TryCast(Session("report"), XtraReport)
If report IsNot Nothing Then
ExportReport(report, "report", Request.QueryString("ddlExportType"), Convert.ToBoolean(Request.QueryString("bInline")))
Else
Label1.Visible = True
End If
End Sub
Public Sub ExportReport(ByVal report As XtraReport, ByVal fileName As String, ByVal fileType As String, ByVal inline As Boolean)
Dim stream As New MemoryStream()
Response.Clear()
If fileType = "xls" Then
report.ExportToXls(stream)
End If
If fileType = "pdf" Then
report.ExportToPdf(stream)
End If
If fileType = "rtf" Then
report.ExportToRtf(stream)
End If
If fileType = "csv" Then
report.ExportToCsv(stream)
End If
Response.ContentType = "application/" & fileType
Response.AddHeader("Accept-Header", stream.Length.ToString())
If inline Then
Response.AddHeader("Content-Disposition", ("Inline") & "; filename=" & fileName & "." & fileType)
Else
Response.AddHeader("Content-Disposition", ("Attachment") & "; filename=" & fileName & "." & fileType)
End If
Response.AddHeader("Content-Length", stream.Length.ToString())
'Response.ContentEncoding = System.Text.Encoding.Default;
Response.BinaryWrite(stream.ToArray())
Response.End()
End Sub
End Class