I have created a wonderful report with Infragistics.Documents.Report.Report. I am able to save it to a PDF, XPS, and send it directly to a printer and it looks as wonderful as can be, but... Others want to see it in a print preview dialog before printing. How might one go about doing that?
Sam
The way the grid sample works is it calls the report.Generate method which creates an IProjectionPageCollection. These are used in the PrintPage event of a PrintDocument (or UltraPrintDocument in this case) and essentially draw onto each printed page.
Hi Mike,
Actually I had already found that example and used it to print a report of a UltraGrid, but I am not seeing how to apply that to displaying a report. Here is what I have:
Infragistics.Documents.Report.Report report = new Report();CreateReport(asmtIds, resourceManager, parentWindow.Handle, dbConnInfo, report);Infragistics.Win.Printing.UltraPrintPreviewDialog ultraPrintPreviewDialog = new Infragistics.Win.Printing.UltraPrintPreviewDialog(); ultraPrintPreviewDialog.Document = report;ultraPrintPreviewDialog.ShowDialog(parentWindow);
ultraPrintPreviewDialog.Document = report;ultraPrintPreviewDialog.ShowDialog(parentWindow);
The problem is that the 'report' is not of type Document. I don't have a clue how to tell the UltraPrintPreviewDialog to display the report. Any suggestions?
Hi Sam,
I assume you are just using the Print method on the report. Unfortunately, there's currently no PrintPreview method to allow you to send the report to a PrintPreview.Print always goes to a printer.
But there is a way to draw the report onto a print surface yourself. There's a sample of this in the WinGrid SamplesExplorer project. The sample exports a grid to a report and then show a print preview, but the grid is not necessary, it will work for any report.