/// <summary> /// Allow a method for testing without the designer, a preview of sorts /// From here you can print or export /// </summary> private void btnPreview_Click(object sender, EventArgs e) { myXtraReport r = new myXtraReport(); r.DataSource = FillDataset().Tables["Ticket"]; r.LoadLayout(Application.StartupPath + "\\XtraReport1.repx"); ReportPrintTool printTool = new ReportPrintTool(r); printTool.ShowPreview(); }
/// <summary> /// Purpose built function to merge the data with the template and generate a PDF /// </summary> private void btnPDF_Click(object sender, EventArgs e) { myXtraReport r = new myXtraReport(); r.DataSource = FillDataset().Tables["Ticket"]; r.LoadLayout(Application.StartupPath + "\\XtraReport1.repx"); r.ExportToPdf(Application.StartupPath + "\\sample.pdf"); MessageBox.Show("PDF written to: " + Application.StartupPath + "\\sample.pdf"); }
/// <summary> /// Allow a method to edit the report format, spawns a modal form with the report designer control. /// Allows for edit and save of repx files /// </summary> private void btnDesigner_Click(object sender, EventArgs e) { myXtraReport r = new myXtraReport(); r.DataSource = FillDataset().Tables["Ticket"]; r.LoadLayout(Application.StartupPath + "\\XtraReport1.repx"); ReportDesignTool designTool = new ReportDesignTool(r); designTool.ShowRibbonDesignerDialog(); }