Question

I am using Microsoft report (.rdl), I have changed its layout to landscape in report properties. It shows landscape in report viewer but when I save it to pdf through report viewer or by programatically, It didn't save pdf in landscape. It saves pdf in portrait and render one page report to multiple pages.

Était-ce utile?

La solution

Are you sure your report is sized correctly to fit in a landscape page dimensions? Take a look at the answer to this question for some tips on PDF formatting:

How to get rid of blank pages in PDF exported from SSRS

Autres conseils

All you have to do is alternate the report width and height in Report Properties. If you want it on A4 sheet, then give width=29cm and height=21cm.

Source: http://forums.devarticles.com/microsoft-sql-server-5/reporting-services-export-pdf-in-landscape-9209.html

You can also modify the PageHeight and PageWidth in the DeviceInfo settings.

Example:

string deviceInfo =
            "<DeviceInfo>" +
            "  <OutputFormat>PDF</OutputFormat>";
        if (!landscape)
        { // display report in portrait
            deviceInfo +=
            "  <PageWidth>8.5in</PageWidth>" +
            "  <PageHeight>11in</PageHeight>";
        }
        else // display report in Landscape
        {
            deviceInfo +=
            "  <PageWidth>16in</PageWidth>" +
            "  <PageHeight>8.5in</PageHeight>";
        }
        deviceInfo +=
            "  <MarginTop>0.5in</MarginTop>" +
            "  <MarginLeft>0.5in</MarginLeft>" +
            "  <MarginRight>0.5in</MarginRight>" +
            "  <MarginBottom>0.5in</MarginBottom>" +
            "</DeviceInfo>";
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top