2009-02-15 67 views
1

在SQL Server Reporting Services(SSRS)中,報表的頁面上的列數設置在報表屬性中(這與數量不同字段列隨數據而變化)。
默認情況下,它被設置爲1,但可以是兩個或更多,然後向下流動。如何動態更改SSRS主體中的列數

我希望能夠動態設置它,這取決於我使用的打印機的類型(標籤卷或紙張)。但是,SSRS不允許您爲此值輸入表達式。有沒有人有辦法通過代碼做到這一點?

回答

0

你可以做的是在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
然後,在打印前,只要選擇合適的呈現格式。

但是,它會更容易指定報告URL thouse設置:

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 

Specifying Device Information Settings in a URL
你也可以創建一些主要報告,並把thouse鏈接存在。

+0

謝謝 - 這不是我正在尋找的答案,但至少讓我指出了正確的方向,並給了我一些想法。 – wilson32 2009-02-25 14:56:40