自訂 HTML 檢視器及報表管理員的樣式表Customize Style Sheets for HTML Viewer and Report Manager

Reporting ServicesReporting Services 提供預設的階層式樣式表 (.css) 檔案會定義樣式報表工具列在 HTML 檢視器和報表管理員。provides default cascading style sheets (.css) files that define styles for the report toolbar in HTML Viewer and for Report Manager. 如果您是 Web 開發者,或您有建立階層式樣式表的專業知識,您可以修改預設樣式 (自行負責風險),來變更工具列或報表管理員的色彩、字型和配置。If you are a Web developer or have expertise in creating cascading style sheets, you can modify the default styles at your own risk to change the colors, fonts, and layout of the toolbar or Report Manager. 此版本未收錄預設樣式表或樣式表的修改指示。Neither the default style sheets nor instructions for modifying the style sheets are documented in this release.

以不正確的方式修改樣式表,可能會導致在開啟報表時發生錯誤。Modifying the style sheets incorrectly can result in errors when opening reports. 如果您不知道如何修改樣式表,請使用預設的樣式表。If you do not know how to modify style sheets, you should use the default style sheets. 如果您選擇自訂樣式表,請務必在進行任何修改之前建立所有預設 .css 檔的備份。If you choose to customize the style sheets, be sure to create a backup of all default .css files before making any modifications.

修改樣式表對執行於報表伺服器上的已發行報表之外觀沒有影響。Modifying style sheets has no effect on the appearance of published reports that you run on a report server. Reporting ServicesReporting Services中,報表不會參考樣式表。In Reporting ServicesReporting Services, reports do not reference style sheets. 報表伺服器自動產生的特定報表,會使用儲存在報表伺服器程式檔案中做為內嵌資源的樣式資訊。Ad hoc reports that are auto-generated by the report server use style information that is stored as an embedded resource in the report server program files. 您在報表設計師中建立的報表,會使用您在報表定義中指定的字型、色彩和配置。Reports that you create in Report Designer use the fonts, colors, and layout that you specify in the report definition. 樣式會搭配配置的剩餘部分內嵌建立。Styles are created inline with the rest of the layout.

注意

如果您要使用預先定義的報表樣式,請利用「報表精靈」來建立報表。If you want to use predefined report styles, use the Report Wizard to create a report. 「報表精靈」提供各種主旨,可讓您用來建立使用不同色彩組合和字型的樣式化報表。The Report Wizard provides a variety of themes that you can use to create stylized reports that use different color combinations and fonts. 您可以修改定義報表主旨的樣式範本。The style templates that define the themes for a report can be modified.

Reporting Services 樣式表Reporting Services Style Sheets

下表描述用於 Reporting ServicesReporting Services 安裝的樣式表 (.css) 檔案。The following table describes the style sheet (.css) files that are used in a Reporting ServicesReporting Services installation.

樣式表Style sheet 描述Description
Htmlviewer.cssHtmlviewer.css 提供範例樣式表做為範本,讓您用來建立 HTML 檢視器中 [報表] 工具列的自訂樣式。Provides a sample style sheet that you can use as a template to create custom styles for the report toolbar in HTML Viewer.

HTML 檢視器所使用的預設樣式會編譯至報表伺服器中。The default styles used by HTML Viewer are compiled into the report server. Htmlviewer.css 檔提供檢視器使用的樣式範例。The Htmlviewer.css file provides a sample of the styles that the viewer uses.
ReportingServices.cssReportingServices.css 定義報表管理員的樣式。Defines styles for Report Manager.

設定 Reporting Services 來使用自訂樣式表Configuring Reporting Services to Use a Custom Style Sheet

樣式表必須是有效的階層式樣式表 (.css) 檔案,且必須位於 [Styles] 資料夾中。The style sheet must be a valid cascading style sheet (.css) file and it must be located in the Styles folder. 根據預設,[Styles] 資料夾是位於<磁碟機>: \Program Files\Microsoft SQL Server\MSSQL。n\Reporting Services\ReportServer\Styles。By default, the Styles folder is located at <drive>:\Program Files\Microsoft SQL Server\MSSQL.n\Reporting Services\ReportServer\Styles.

若要在執行階段使用 HTML 檢視器的自訂樣式表,您可以從下列方式選擇:To use a custom style sheet for HTML Viewer at run time, you can choose from these approaches:

  • 加入 <HTMLViewerStyleSheet> 設定為Reporting ServicesReporting Services組態檔。Add the <HTMLViewerStyleSheet> setting to the Reporting ServicesReporting Services configuration file.

  • 在報表 URL 上指定樣式表。Specify the style sheet on a report URL.

修改 RSReportServer.config 檔Modifying the RSReportServer.config File

您可以修改 RSReportServer.config 檔來指定 HTML 檢視器的自訂樣式表。You can modify the RSReportServer.config file to specify a custom style sheet for HTML Viewer. <HTMLViewerStyleSheet> 設定為預設不包含檔案中。The <HTMLViewerStyleSheet> setting is not included in the file by default. 您也必須將它輸入 <Configuration> 選取的 RSReportServer.config 檔案,然後再指定您想要使用的樣式表。You must type it into the <Configuration> selection of the RSReportServer.config file and then specify the style sheet you want to use. 指定樣式表時,請不要包含 .css 檔延伸模組。Do not include the .css file extension when specifying the style sheet.

下列範例說明如何指定樣式表:The following example provides an illustration of how to specify the style sheet:

<Configuration>  
...  
          <HTMLViewerStyleSheet>MyStyleSheet</HTMLViewerStyleSheet>  
...  
</Configuration>  

在報表 URL 上指定樣式表Specifying a Style Sheet on a Report URL

您可以使用 rc:StyleSheet URL 存取參數,在報表 URL 上指定自訂樣式表。You can use the rc:StyleSheet URL access parameter to specify a custom style sheet on the report URL. 如需如何指定 URL 存取參數的詳細資訊,請參閱URL 存取參數參考For more information about how to specify URL access parameters, see URL Access Parameter Reference.

下列範例說明如何加入自訂樣式:The following example provides an illustration of how to add custom styles:

http://localhost/reportserver?/AdventureWorksSampleReports/Product+Line+Sales&rs:Command=Render&rc:Stylesheet=MyStyleSheet  

另請參閱See Also

報表管理員 (SSRS 原生模式) Report Manager (SSRS Native Mode)
HTML 檢視器和報表工具列 HTML Viewer and the Report Toolbar
RSReportServer 設定檔RSReportServer Configuration File