Set report (RDLC) as always landscape printing and A4

Mustafa Ismail Mustafa picture Mustafa Ismail Mustafa · May 30, 2011 · Viewed 40.6k times · Source

Is there a way to set an RDLC report to be always Landscape and to always use A4 without the need of manually doing so every time through the print dialog? I've been at this for a few hours and nothing came up after googling.

Indeed, is there a way to skip the print dialog in itself?

TIA

Answer

hawbsl picture hawbsl · Jun 8, 2011

You can certainly avoid the print dialog and print directly, also you can specify page size and print orientation in code. We do it in our projects but the code is a bit of muddle plus it's in VB so I won't post a chunk of it here.

MSDN has a page titled Walkthrough: Printing a Local Report without Preview. This code has some XML to set the page size:

      "  <PageWidth>8.5in</PageWidth>" + _
      "  <PageHeight>11in</PageHeight>" + _

Change this to 29.7cm & 21cm for A4 Landscape.