private void Btn_Excel_Click(object sender, EventArgs e)
        {
            SaveFileDialog Archivo = new SaveFileDialog();

            if (Archivo.ShowDialog() == DialogResult.OK)
            {
                CrystalDecisions.Shared.ExportOptions              Opt     = new CrystalDecisions.Shared.ExportOptions();
                CrystalDecisions.Shared.ExcelFormatOptions         Opt_Exc = new CrystalDecisions.Shared.ExcelFormatOptions();
                CrystalDecisions.Shared.DiskFileDestinationOptions Opt_Dsk = new CrystalDecisions.Shared.DiskFileDestinationOptions();

                Opt.ExportFormatType      = CrystalDecisions.Shared.ExportFormatType.Excel;
                Opt.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;

                Opt_Exc.ExcelUseConstantColumnWidth = false;
                Opt.ExportFormatOptions             = Opt_Exc;

                Opt_Dsk.DiskFileName         = Archivo.FileName;
                Opt.ExportDestinationOptions = Opt_Dsk;
                Reporte.Export(Opt);
            }
        }
Exemple #2
0
 private void frmManageMenu_Load(object sender, EventArgs e)
 {
     this.Text = "Reporting";
     if (clientnamE == "PO")
     {
         this.Text = clientnamE + " event";
         CrystalReport2 eventss = new CrystalReport2();
         eventss.SetDataSource(eventDetails);
         CrystalDecisions.Shared.ExcelFormatOptions XLSFormatOptions = new CrystalDecisions.Shared.ExcelFormatOptions();
         XLSFormatOptions.ShowGridLines = true;
         XLSFormatOptions.ExportPageBreaksForEachPage = true;
         crystalReportViewer1.ReportSource            = eventss;
     }
     else if (clientnamE == "Summary")
     {
         this.Text = clientnamE + " event";
         SummaryReport eventss = new SummaryReport();
         eventss.SetDataSource(eventDetails);
         crystalReportViewer1.ReportSource = eventss;
     }
     else if (clientnamE == "OverallReport")
     {
         this.Text = "Selected events Summary";
         OverallReport eventss = new OverallReport();
         eventss.SetDataSource(eventDetails);
         crystalReportViewer1.ReportSource = eventss;
     }
     else
     {
         CrystalReport1 eventss           = new CrystalReport1();
         int            exportFormatFlags = (int)(CrystalDecisions.Shared.ViewerExportFormats.PdfFormat | CrystalDecisions.Shared.ViewerExportFormats.ExcelFormat);
         crystalReportViewer1.AllowedExportFormats = exportFormatFlags;
         eventss.SetDataSource(eventDetails);
         crystalReportViewer1.ReportSource = eventss;
     }
 }