There is a situation where we want to change the exported report name and send it as mail attachment.
Currently, crystal reports is using loaded file name as name to be used while sending.
We could not find any property exposed by crystal API through which report name can be changed at run-time while sending as mail or to exchange folder.
Will appreciate if someone can suggest any property available or some suitable workaround if someone has faced similar kind of problem.
Version details:
VS 2010 SP1
Crystal Report for Visual Studio: Support Pack 10 (v.13.0.10.1385 )
Crystal Report Designer 2013
Example:
The saved report name is Report101.rpt and I want to send the exported report in mail as EmpDetails.rpt, but I could not find any property to change the report name.
Code Snippet:
'----------------------------------------------
Dim mailOptions As MicrosoftMailDestinationOptions = ExportOptions.CreateMicrosoftMailDestinationOptions()
Dim exportOption As New ExportOptions
Dim result As DialogResult = GetMailData(mailOptions.MailToList, mailOptions.MailCCList, mailOptions.MailSubject, mailOptions.MailMessage)
If DialogResult.OK <> result Then
Return
End If
exportOption.ExportDestinationOptions = mailOptions
exportOption.ExportFormatOptions = options
exportOption.ExportDestinationType = ExportDestinationType.MicrosoftMail
exportOption.ExportFormatType = format.Type
_mainRep.CrystalRepDoc.Export(exportOption)
'----------------------------------------------
Regards,
Prateek