2
votes

I've got a report that I created in Crystal Reports for Visual Studio 2010.

The report is set to landscape. If I create an instance of the report, load it with data and print it using the following code, it prints in landscape as expected.

        var rpt = new MyReport();
        rpt.SetDataSource(dataSource);
        rpt.PrintToPrinter(1, false, 1, int.MaxValue);

If I view the report in the Crystal Report viewer control for WPF using the following code, the report is shown correctly in landscape mode.

        var rpt = new MyReport();
        rpt.SetDataSource(dataSource);
        ReportViewer.ViewerCore.ReportSource = rpt;

However, if I click the Print button in the Crrystal Report Viewer control, the print comes out as portrait, truncating the right side of the report and not filling the page top to bottom.

Is there a fix for this?

1

1 Answers

1
votes

I am not sure if there is a fix for this but it seems like a few people are having the same problem. I found a couple of links that might help.

On this link (about half way down) a guy suggests setting your default printer Microsoft XPS Document Writer. Not sure why that would work but worth a try.

This second link seems more promising. They mention that the Report Viewer is very buggy and that by using the ReportDocument instead you can override the PaperOrientation property of the report and set it to Landscape manually.

Let me know if these links help.