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

            rpt.Site = this.Site;
            return(rpt);
        }
Example #2
0
        //public static Jadwal_Mata_Kuliah cr1;
        //public static string filename;
        private void btnCetakJadwalMatakuliah_Click(object sender, EventArgs e)
        {
            //jm.Show(); OracleDataAdapter adap = new OracleDataAdapter("SELECT*FROM JADWAL_MATAKULIAH",conn);
            //DataSet ds = new DataSet(); adap.Fill(ds, "JADWAL_MATAKULIAH");

            //cr1.SetDataSource(ds); jm.crystalReportViewer1.ReportSource = cr1; jm.crystalReportViewer1.Refresh();

            //string filename = System.Windows.Forms.Application.StartupPath + "\\Jadwal_Mata_Kuliah.rpt";
            //cr1.Load(filename);
            //cr1.SummaryInfo.ReportTitle = "JADWAL MATA KULIAH";
            //cr1.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, cr1.SummaryInfo.ReportTitle + ".pdf");
            //jm.crystalReportViewer1.ReportSource = cr1; jm.crystalReportViewer1.Refresh();

            try
            {
                Jadwal_Mata_Kuliah_Viewer jm     = new Jadwal_Mata_Kuliah_Viewer();
                Jadwal_Mata_Kuliah        objRpt = new Jadwal_Mata_Kuliah();
                string sql = "SELECT*FROM JADWAL_MATAKULIAH";
                //OracleDataAdapter da = new OracleDataAdapter(sql, conn);
                //DataSetJMK dsj = new DataSetJMK(); da.Fill(dsj, "JADWAL_MATAKULIAH");
                //MessageBox.Show(dsj.Tables[1].Rows.Count.ToString());
                //objRpt.SetDataSource(dsj.Tables[1]);
                jm.crystalReportViewer1.ReportSource = objRpt;
                jm.crystalReportViewer1.Refresh();

                ExportOptions CrExportOptions;
                DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
                PdfRtfWordFormatOptions    CrFormatTypeOptions          = new PdfRtfWordFormatOptions();
                CrDiskFileDestinationOptions.DiskFileName = "C:\\Users\\Administrator\\Desktop\\Jadwal Matakuliah Proyek PCS.pdf";
                //System.IO.Path.GetTempPath(diskf);

                CrExportOptions = objRpt.ExportOptions;
                {
                    CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    CrExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    CrExportOptions.DestinationOptions    = CrDiskFileDestinationOptions;
                    CrExportOptions.FormatOptions         = CrFormatTypeOptions;
                }
                objRpt.Export();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }