Search code examples
devexpressxtrareport

DevExpress XtraReporty Print Without any UI Interaction


I am having some trouble trying to get a report to print from a service that does not allow UI interaction.

Currently I can do the following

Dim myReport As New MyXtraReport(myData)
myReport.CreateDocument()

'Then I attempt to do the following

DirectCast(myReport.PrintingSystem, PrintingSystem).Print

However nothing happens when I do this. I don't get any exceptions just no document is printed.

Calling myReport.Print()

will print the correct document but with UI interaction. What am I missing or is this just not intended to be viable.

I have also tried using the myReport.PritingSystem.ExecCommand(PrintDirectly) but it also doesn't print anything.


Solution

  • You only need to call the Report's Print method:

    new XtraReport1().Print();
    

    I've tried this and it works. If it does not work, I suggest that you post a sample in the support center and we will try to help you.