public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { weeklySchedule rpt = new weeklySchedule(); rpt.Site = this.Site; return(rpt); }
private void button2_Click(object sender, EventArgs e) { DataSet ds = new DataSet(); DataTable dt = new DataTable(); dt.Columns.Add("الساعة"); dt.Columns.Add("السبت"); dt.Columns.Add("الأحد"); dt.Columns.Add("الأثنين"); dt.Columns.Add("الثلاثاء"); dt.Columns.Add("الأربعاء"); dt.Columns.Add("الخميس"); foreach (DataGridViewRow dgv in dataGridView1.Rows) { dt.Rows.Add(dgv.Cells[0].Value, dgv.Cells[1].Value, dgv.Cells[2].Value, dgv.Cells[3].Value, dgv.Cells[4].Value, dgv.Cells[5].Value, dgv.Cells[6].Value); } ds.Tables.Add(dt); ds.WriteXmlSchema("document.xml"); weeklySchedule cr = new weeklySchedule(); cr.SetDataSource(ds); System.Drawing.Printing.PrintDocument printDoc = new System.Drawing.Printing.PrintDocument(); cr.PrintOptions.PrinterName = printDoc.PrinterSettings.PrinterName; cr.PrintToPrinter(1, true, 0, 0); }