Skip to Content
0
Former Member
Nov 20, 2008 at 07:02 AM

How to prompt Export-Format-Dialog from Report-Viewer

195 Views

I'm using .net 2008 and CR 2008 for reporting.

In a form I placed the ReportViewer.

Everything works fine.

Here my problem: When I click "Export" in the Viewer I get the File-Dialog with Excel, Word, PDF.

But I'm missing the dialog where I can choose MAPI (Microsoft Mail) as destination. Like it is possible

at design-time.

To illustrate, how I implemented the CR 2008 in our application:

Public Sub ReportStarten()

Dim l As Integer

Dim Cmd As System.Data.SqlClient.SqlCommand = Nothing

Dim Reader As System.Data.SqlClient.SqlDataReader = Nothing

Dim ReportDataTable As System.Data.DataTable

Dim SqlConn As New System.Data.SqlClient.SqlConnection()

Dim ReportFenster As New ReportForm

If Me._DruckVorschau Then

ReportFenster.Text = Me.Reporttitel

ReportFenster.Show()

ReportFenster.WindowState = Windows.Forms.FormWindowState.Maximized

End If

'Diese Selektion wird im Report selbst berücksichtigt

Me._ReportRpt.DataDefinition.RecordSelectionFormula = Me._RecordSelection

l = 0

Dim myTables As CrystalDecisions.CrystalReports.Engine.Tables = Me._ReportRpt.Database.Tables

For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables

SqlConn.ConnectionString = Me._ConnectionString

SqlConn.Open()

Cmd = New System.Data.SqlClient.SqlCommand(Me._TableSource(l))

Cmd.Connection = SqlConn

Reader = Cmd.ExecuteReader(CommandBehavior.CloseConnection)

ReportDataTable = New System.Data.DataTable()

ReportDataTable.Load(Reader)

myTable.SetDataSource(ReportDataTable)

l += 1

Next

If Me._DruckVorschau Then

'Vorschau

ReportFenster.CrystalReportViewer.ReportSource = Me._ReportRpt

Else

'Sofortdruck

Me._ReportRpt.PrintOptions.PrinterName = Me._DruckerName

Me._ReportRpt.PrintToPrinter(1, False, 0, 0)

'

End If