This is a migrated thread and some comments may be shown as answers.

Problem deploying external stylesheet

2 Answers 201 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 28 Jun 2011, 01:25 PM
Hi,

I'm using Reporting v Q3 2010.  I have a solution which contains a web project and a separate projectect for my Telerik reports.  So when I deploy my site, the Telerik reports are built in to a dll that sits in my site's /bin folder.  This is fine, and all works very well, except that one of my reports uses an external stylesheet which is not being picked up when I run the report in the production environment.

I've tried the three methods of referencing the external stylesheet from this report, but only the absolute method works, and I can't really use that in a production environment.  If I use 'Relative' mode, it seems to be expecting to find the stylesheet xml file in a path relative to the root of the Reports project I created.  But of course I'm not deploying the project, just the dll created from it.  Similarly, using the 'Resource' mode, it seems to be expecting to find the xml file in a Resources folder within the Reports project, not the website.

I've tried placing the xml file in just about every location I can think of (even creating a folder structure in my website to reflect the one in my development environment), and switching between Relative and Resource modes when adding the style sheet to my report.  But nothing works, and the report is always rendered without the styles from the stylesheet.  All of the documentation I can find on this site seems to expect that my reports are part of the same project as the website itself, but that's not my scenario.

Please can someone explain how to reference an external stylesheet from a report when that report will be built into a dll and deployed in a website's /bin folder.

Thanks!

2 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 01 Jul 2011, 10:01 AM
Hi Michael,

The location of the external stylesheet needs to be relative to the page containing the report viewer. If the viewer page is not in the root, the path to the stylesheet should contain "~\" i.e.

now:
Me.ExternalStyleSheets.Add(New Telerik.Reporting.Drawing.ExternalStyleSheet("StyleSheets\TestStyleSheet.xml"))

should be:
Me.ExternalStyleSheets.Add(New Telerik.Reporting.Drawing.ExternalStyleSheet("~\StyleSheets\TestStyleSheet.xml"))

You can change this path manually in the report InitializeComponent method. We would take care of this small glitch in the next version.

All the best,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael
Top achievements
Rank 1
answered on 01 Jul 2011, 10:18 PM
Hi Steve,

Many thanks!  I'm not actually using a report viewer, I'm launching all my reports directly as pdfs in code.  However, you prompted me to remember that I'm doing this via a page that I'm passing various parameters to in order to launch the relevant report.  So, placing the stylesheet in a folder relative to that page has solved the problem!

Thanks once again for your excellent customer service.

Michael
Tags
General Discussions
Asked by
Michael
Top achievements
Rank 1
Answers by
Steve
Telerik team
Michael
Top achievements
Rank 1
Share this question
or