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
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
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...
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!
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...
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!