Need Help in implementing pdf file from crystal report+send it through mail

May 24 2011 1:50 AM
Hello Friends

I am creating one project in web application in which i used crystal report. now i want to make pdf file from crystal report and i have to send it through mail. basically for this i used following code.

try
        {
            ExportOptions CrExportOptions;
            DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
            PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
            CrDiskFileDestinationOptions.DiskFileName = pdfFile;
            CrExportOptions = ReportDocument .ExportOptions;//Report document  object has to be given here
            CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
            CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
            CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
            CrExportOptions.FormatOptions = CrFormatTypeOptions;
            ReportDocument .Export();

            //sendmail();
        }
        catch (Exception ex)
        {
            //MessageBox.Show(ex.ToString());
        }

all the other but i am geeting two error on two diff lines where i have make bold in the qustion.
this is the error for both .
An object reference is required for the non-static field, method, or property 'CrystalDecisions.CrystalReports.Engine.ReportDocument.Export()
 
For this i searched lot more things  but i din't get proper solution.

please help me to  solve the error.





Answers (3)