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

RenderReport w/ PDF and the formatting from ExternalStyleSheets is lost

5 Answers 87 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 05 May 2011, 02:54 PM
I have a group of reports which each have ExternalStyleSheets set at design time to xml files attached to the project.   The reports all display fine in preview mode. 

The problem occurs when using the ReportProcessor-->RenderReport() method to call these reports.   It appears that it doesn't utlizie the ExternalStyleSheets, since all formatting defined in those files is lost. 

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 10 May 2011, 04:03 PM
Hello Tom,

We have made some tests by exporting programmatically reports that use ExternalStyleSheets but we are unable to reproduce the described behavior. When you add a new external style sheet to the collection it will be recorded with a relative or absolute path depending on the file's location. If the file that you choose is located inside the current project root directory the style sheet will be recorded with relative path, otherwise it will be recorded with absolute path. However, when you use a relative path and the reports are located in a class library then you have to copy the external stylesheet file to the application's bin folder or set the 'Copy to Output Directory" property of the stylesheet file to Copy Always.

Kind regards,
Peter
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
Brian Norris
Top achievements
Rank 1
Iron
answered on 14 Feb 2013, 07:17 PM
I seem to have the same exact problem. I'm using Q1 2012. My application has the reports in the same, main project, in a separate folder, but under the application root. As Peter suggested, I have 'Copy Always' set and I also manually copied the style file to the application's bin folder. The path is relative and points to the folder that contains both the report and the stylesheet files. The report previews perfectly in the designer and also displays perfectly in a viewer. But when ReportProcessor.RenderReport is used to create a file for emailing the stylesheet is not used. Peter, Tom, do you have any other suggestions or solutions for me? Tom, did Peter's suggestions work for you? 

This isn't a HUGE problem at the moment as we're only dealing with a single report and the improper formatting isn't horrible. Still, I'd love to solve this sometime soon as I know we'll be deploying many more reports in the future. So if needed I could create a sample project at some point in the near future if that would help in debugging things. 

Thanks in advance for any help you can give me. Cheers...
0
Stef
Telerik team
answered on 18 Feb 2013, 02:25 PM
Hi Brian,

As described in this help article Exporting and Reusing Style Sheets:
"When an external style sheet is referenced relatively the path is relative to the hosting application root folder".
You can always use the other two kinds of  locations to ensure that stylesheets are applied without additional copies in the folders.

Let us know if you have further questions.

Kind regards,
Stef
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Brian Norris
Top achievements
Rank 1
Iron
answered on 18 Feb 2013, 03:36 PM
Stef,

Thanks for the response. Here's what I found...

The link to Exporting and Reusing Style Sheets states that relative paths can be used: 

Relative Path/URL
 such as .\StyleSheets\StyleSheet1.xml or ~/StyleSheets/StyleSheet1.xml

However, when using the Properties / ExternalStyleSheets dialog to specify a file the .\ or ~/ are NOT included in the relative path. In my case I would expect ~/reports/reportStyles.xml, but instead I get just reports/reportStyles.xml. As far as I can tell, there is no way to manually edit that path and therefore no way to get the correct relative path specified. I see that a URL may be specified programmatically, but it seems to me that the designer should set the relative path to work properly so that programmatic setting is not required. (I may be able to get away with this in the current project as all reports should use the same sheet and will be launched from only one or two locations in code.)

As a second attempt I tried to simply specify that as a Resource by changing the Kind dropdownlist to Resource. That appears to have done the job - the file is copied to a new ~/Resources folder, the report previews as expected and exports properly. However, when I return to the External Style Sheets dialog the specification is highlighted in red and the Kind says 'Invalid'. I tried re-specifying the file and got the same 'Invalid' response. Still, the report seems to process properly, so at least my problem is solved, even if the designer interface seems to be confused.

I hope that is, first of all, fully correct, but also that it may help others struggling with this issue. Let me know if there is any info I can provide to help out. Cheers...
0
Stef
Telerik team
answered on 18 Feb 2013, 05:13 PM
Hi Brian,

These are examples of relative paths and the stored path in the designer.cs file (reports/reportStyles.xml) is also relative. It will be calculated as absolute based on the URL of your application.
About your second issue, we are aware of it and the fix will be provided in a future release.

Let us know if you have any further questions.

Greetings,
Stef
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

Tags
General Discussions
Asked by
Tom
Top achievements
Rank 1
Answers by
Peter
Telerik team
Brian Norris
Top achievements
Rank 1
Iron
Stef
Telerik team
Share this question
or