views:

668

answers:

1

In SQL Server Reporting Services (SSRS), the number of columns on a page for a report is set in the Report Properties (this is not the same as the number of field columns which vary with the data).
By default this is set one, but it could be two or more, flowing down then across.

I want to be able to set this dynamically, depending on the type of printer I'm using (label roll or sheet). However, SSRS does not allow you to enter an expression for this value. Does anyone have a way of doing this via code?

A: 

What you can do is to define several custom rendering options in rsreportserver.config:

<Render>
    <Extension Name="PDF (1 column)" 
         Type="Microsoft.ReportingServices.Rendering.ImageRenderer.PdfReport, 
               Microsoft.ReportingServices.ImageRendering"/>
        <OverrideNames>
            <Name Language="en-US">PDF (1 column)</Name>
        </OverrideNames>
        <Configuration>
            <DeviceInfo>
                <OutputFormat>PDF</OutputFormat>
                <PageHeight>11in</PageHeight>
                <PageWidth>8.5in</PageWidth>
                <Columns>1<Columns>
            </DeviceInfo>
        </Configuration>
    </Extension>
    <Extension Name="PDF (2 columns)" 
         Type="Microsoft.ReportingServices.Rendering.ImageRenderer.PdfReport, 
               Microsoft.ReportingServices.ImageRendering"/>
        <OverrideNames>
            <Name Language="en-US">PDF (2 columns)</Name>
        </OverrideNames>
        <Configuration>
            <DeviceInfo>
                <OutputFormat>PDF</OutputFormat>
                <PageHeight>11in</PageHeight>
                <PageWidth>8.5in</PageWidth>
                <Columns>2<Columns>
            </DeviceInfo>
        </Configuration>
    </Extension>
</Render>

Customizing Rendering Extension Parameters in RSReportServer.Config
PDF Device Information Settings
Then, before printing, just choose appropriate rendering format.

However, it will be easier to specify thouse settings in Report url:

http://servername/reportserver?/SampleReports/Employee SalesSummary
  &EmployeeID=38&rs:Command=Render&rs:Format=HTML&rc:Columns=1
http://servername/reportserver?/SampleReports/Employee SalesSummary
  &EmployeeID=38&rs:Command=Render&rs:Format=HTML&rc:Columns=2

See Specifying Device Information Settings in a URL
You can also create some Main Report and place thouse links there.

Max Gontar
Thanks - not quite the answer I was looking for, but at least points me in the right direction, and gives me some ideas to work on.
wilson32
You're welcome Wilson32, I'm happy it was helpfull in the least way :)
Max Gontar