¿Por qué mi Crystal Report se imprime en vertical cuando uso el visor de informes?

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.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();
        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.

¿Hay una solución para esto?

preguntado el 31 de julio de 12 a las 11:07

1 Respuestas

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 este enlace (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.

Este segundo aquí 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.

Respondido 01 ago 12, 17:08

I'm actually testing against the XPS Writer so that doesn't help unfortunately. The problem with the other method shown is that it's printing directly. I actually use that method elsewhere in the software for reports that don't need to be viewed first. On this one the customer wants to view the report to check it before printing. Hence the use of the viewer. TBH, I get the impression that the whole of CR is a little shoddy at the moment, including the installer for the software! The customer uses CR though so I have no other option. - Richard

Richard - What do they want to do in the viewer? Is it just a print preview? As a possible workaround could you raise a PDF instead? - Ken Cenerelli

At the moment it's a print preview but with an element of interactivity. I don't think a PDF would be acceptable. - Richard

5 years on, is anyone close to an answer for this? - señorhombre

@MikeDWakelyn Not yet. The only way is to avoid using the print button and implement your own button with a call to PrintToPrinter. - Nicke Manarín

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.