Search code examples
winformsdevexpressxtrareport

How can I access the form used to show a preview of a DevExpress XtraReport?


DevExpress have no simple report viewer control for using an XtraReport on a Windows Form, but simply calling ShowPreview on the report does a great job anyway:

var report = new ClientNameReport();
report.ShowRibbonPreview();

The above code shows a non-model form with my report and a nice ribbon control for doing all the report viewing things one could want, but the caption text of the form is Preview, and I would like to set it to the name of the report. The report has a Container property, but I can't find where this is non-null.

How can I access the form hosting the report and change its caption?


Solution

  • I hope this code fixes your problem:

    var report = new ClientNameReport();
    var reportPrintTool = new ReportPrintTool(report);
    reportPrintTool.PreviewRibbonForm.Text = "Some Text"
    report.ShowRibbonPreview();