Search code examples
htmlcssssrs-2008reporting-servicesreportmanager

Attaching External Style Sheet to a HTML Page in SSRS and Report Manager


I have an HTML page that I wrote that I need to host in the SSRS Report Manager, due to some restrictions. The HTML is just a collection of static web pages that connect to a Style.css style sheet.

When I run the pages outside SSRS they work fine, but when I run them in the Report Manager I lose my styling in the HTML. I am not sure what I need to change for this to work in SSRS and Report Manager.

I tried the logical thing which was an absolute path to the CSS file in SSRS and the process found here: http://msdn.microsoft.com/en-us/library/ms345247.aspx but I can't get either to work. Any help would be greatly appreciated.


Solution

  • The trick is that you have to point it to the ReportServer URL not the Reports URL. See the below examples which demonstrates how the URL changes. Before

    http://<reportserver>/Reports/Pages/Resource.aspx?ItemPath=%2f<folderPath>%2fStyle.css
    

    After

    https://<reportserver>/ReportServer/Pages/Resource.aspx?%2f<folderPath>%2fStyle.css
    

    As a test you can enter it into your browsers address bar and it is shows you the code then you have it correct. If not then it will have you download the file. Then from there you just put it in the link tag of HTML, like below.

    <link href="https://<reportserver>/ReportServer/Pages/Resource.aspx?%2f<folderPath>%2fStyle.css" type="text/css" rel="stylesheet">
    

    Note that if you are accessing this from the same root (https://<reportserver>/ReportServer/Pages) that your page is located, then you can use the short hand as follows.

    <link href="~/Resource.aspx?%2f<folderPath>%2fStyle.css" type="text/css" rel="stylesheet">