Symptom
- Clicking on the Export button of the viewer a choice of export formats is presented
- The default export file format is an .rpt file
- How to make the default export file format different?
- How to remove certain export formats?
Resolution
*** Warning ***
- The following code is provided as-is and is considered use at your own risk.
- This is not supported by SAP and is provided as a work around only.
- SAP does not guarantee the functionality of this or its' continued functionality in future release.
- Remove the viewer Export button from the toolstrip
- Add a new Export button
- On click event of the new Export button, present the user with custom export form
- Use the following sample code
Private Sub frmReportPreview_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ts As ToolStrip
Dim currentExportButton As ToolStripButton
Dim newExportButton As ToolStripButton
' Replace the export button with our own export button so we can handle the event ourselves
ts = DirectCast(CRViewer.Controls(4), ToolStrip)
currentExportButton = DirectCast(ts.Items(0), ToolStripButton)
ts.Items.Remove(currentExportButton)
newExportButton = New ToolStripButton("", My.Resources.Export, AddressOf ExportButton_Click)
newExportButton.ToolTipText = "Export report to disk"
ts.Items.Insert(0, newExportButton)
End Sub
- Create windows form 'frmReportExport' that contains the export file types and their order, then use the following code:
Private Sub ExportButton_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim frmExport As frmReportExport
' Allow the user to specify options such as the name of the file and format before exporting.
frmExport = New frmReportExport
frmExport.Report = Report
frmExport.ShowDialog()
End Sub
- Then use the code below to run the export from the custom report export windows form.
Report.ExportToDisk(exportFormat, fileExport.SelectedFilename)
Keywords
KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To
Product
Crystal Reports 2008 V1 ; SAP Crystal Reports XI R2