public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            crWorkingPaper rpt = new crWorkingPaper();

            rpt.Site = this.Site;
            return(rpt);
        }
Exemple #2
0
 private void btnExcel_Click(object sender, EventArgs e)
 {
     //MessageBox.Show(location);
     //MessageBox.Show(rp);
     if (txtFileName.Text == "" && multipleRP != "")
     {
         MessageBox.Show("Please Input a File Name");
         txtFileName.Focus();
     }
     else
     {
         try {
             crWorkingPaper cr1 = new crWorkingPaper();
             cr1.SetDataSource(dtPrinting);
             cr1.SetParameterValue(0, auditPeriod);
             cr1.SetParameterValue(1, auditPeriodEnd);
             cr1.SetParameterValue(2, cmbTerminal.SelectedItem.ToString());
             cr1.SetParameterValue(3, auditorFullName);
             //printWorkingPaper wpcr = new printWorkingPaper();
             //wpcr.crystalReportViewer1.ReportSource = cr1;
             //string basePath = @AppDomain.CurrentDomain.BaseDirectory;
             string basePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
             string fileName = wp + "_" + txtFileName.Text + txtMonthYear.Text + ".xls";
             if (multipleRP == "")//single RP
             {
                 fileName = wp + "_" + txtRP.Text + location + txtMonthYear.Text + ".xls";
             }
             string        path        = Path.Combine(basePath, fileName);
             FileInfo      logFileInfo = new FileInfo(path);
             DirectoryInfo logDirInfo  = new DirectoryInfo(logFileInfo.DirectoryName);
             if (!logDirInfo.Exists)
             {
                 logDirInfo.Create();
             }
             cr1.ExportToDisk(ExportFormatType.Excel, path);
             if (File.Exists(path))
             {
                 System.Diagnostics.Process.Start(path);
             }
         }
         catch (Exception er)
         {
             MessageBox.Show(er.Message);
         }
     }
     //wpcr.ShowDialog();
     //wpcr.Refresh();
 }