So far I've been formatting reports by simply modifying the Style property of the various elements. However, I now have a situation where I would like for users to be able to override the default style. Actually, users are very unlikely to modify the styles themselves, but we need to be able to customize the styles for them.
This "report" is currently done with HTML and we use CSS to make customizations. I'm hoping we can achieve something similar with Telerik reports.
First off, is there a way to feed XML representing an "external stylesheet" directly to the report? Or do we need to write the XML to a file then set a path to that file? The XML will be stored in a database and it would be nice if we could feed the XML directly to the report without having to create a temporary file. I see that there is an overload on the ExternalStyleSheet constructor that takes a Stream. I'll see if I can get that to work.
Second, I don't see a Style Selector that is analogous to the "#ControlId" CSS selector. Is it possible to create styles in the external style sheet that target a specific control by name? If not, I guess I can work around this by setting the StyleName to always match the control name?
Third, when I try to override a style that is defined in the report with a different value in the external style sheet, it doesn't appear to work. For example, the report defines a "InfoPanel" style with a solid border. If I try to remove the border in the external style sheet the border is still there. Here is the external style sheet XML:
Interestingly, setting the border style to "Dashed" instead of "None" does work (the border becomes dashed). But I seem to be unable to remove the border using "None".
I think that's it for now.
Scott
This "report" is currently done with HTML and we use CSS to make customizations. I'm hoping we can achieve something similar with Telerik reports.
First off, is there a way to feed XML representing an "external stylesheet" directly to the report? Or do we need to write the XML to a file then set a path to that file? The XML will be stored in a database and it would be nice if we could feed the XML directly to the report without having to create a temporary file. I see that there is an overload on the ExternalStyleSheet constructor that takes a Stream. I'll see if I can get that to work.
Second, I don't see a Style Selector that is analogous to the "#ControlId" CSS selector. Is it possible to create styles in the external style sheet that target a specific control by name? If not, I guess I can work around this by setting the StyleName to always match the control name?
Third, when I try to override a style that is defined in the report with a different value in the external style sheet, it doesn't appear to work. For example, the report defines a "InfoPanel" style with a solid border. If I try to remove the border in the external style sheet the border is still there. Here is the external style sheet XML:
<?xml version="1.0" encoding="utf-8"?> |
<StyleSheet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
<StyleRule> |
<Style> |
<BorderStyle> |
<Default>None</Default> |
</BorderStyle> |
</Style> |
<Selectors> |
<StyleSelector> |
<Type>ReportItemBase</Type> |
<StyleName>InfoPanel</StyleName> |
</StyleSelector> |
</Selectors> |
</StyleRule> |
</StyleSheet> |
Interestingly, setting the border style to "Dashed" instead of "None" does work (the border becomes dashed). But I seem to be unable to remove the border using "None".
I think that's it for now.
Scott