Runtime Style Loading
Runtime Style Loading
Is it possible to load a *.sts file for styling at run time similar to the external editor? In other words if I create a collection of styles, can I load them at run time via the save file and how would I switch between styles in that collection I just loaded.
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: Runtime Style Loading
Hello,
Yes, you can use the report.Styles.Load() method.
Thank you.
Yes, you can use the report.Styles.Load() method.
Thank you.
Re: Runtime Style Loading
First of all I don't think you understood my question(s)...
1. Can l via Javascript, take a StiReport Object and load a style collection via an exported file into the StiReport, report.styles.load() has no parameters, I am looking for something like report.styles.load('Styles.sts')
2. If this is possible, how do I set the style index for the report, if the sts file has 5 styles and I want index 3, how do I do that.
I may have a few hundred reports and if I add a new style I can't just go open all of them one by one making this modification, its not feasible.
I only see:
loadFromJsonObject(jObject: StiJson) : void
loadFromXml(xmlNode: XmlNode) : void
1. Can l via Javascript, take a StiReport Object and load a style collection via an exported file into the StiReport, report.styles.load() has no parameters, I am looking for something like report.styles.load('Styles.sts')
2. If this is possible, how do I set the style index for the report, if the sts file has 5 styles and I want index 3, how do I do that.
I may have a few hundred reports and if I add a new style I can't just go open all of them one by one making this modification, its not feasible.
I only see:
loadFromJsonObject(jObject: StiJson) : void
loadFromXml(xmlNode: XmlNode) : void
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: Runtime Style Loading
Hello,
Yes, you can use these methods in the JS:
loadFromJsonObject(jObject: StiJson)
loadFromXml(xmlNode: XmlNode)
> 2. If this is possible, how do I set the style index for the report, if the sts file has 5 styles and I want index 3, how do I do that.
You can load your styles in StiStylesCollection and work with it, remove, add etc
Thank you.
Yes, you can use these methods in the JS:
loadFromJsonObject(jObject: StiJson)
loadFromXml(xmlNode: XmlNode)
> 2. If this is possible, how do I set the style index for the report, if the sts file has 5 styles and I want index 3, how do I do that.
You can load your styles in StiStylesCollection and work with it, remove, add etc
Thank you.
Re: Runtime Style Loading
I will have to post an example of how I'm doing this and why its not working when I can get to it.
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: Runtime Style Loading
Hello,
Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?
Thank you.
Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?
Thank you.
Re: Runtime Style Loading
I have the same question!
I want to programatically change the style right before the report generated.
How can I achieve this instead of writing a lot of rules for each of elements / bands / components?
(It must be somewhere some method as the designer does the same job..?!)
Thank you!
I want to programatically change the style right before the report generated.
How can I achieve this instead of writing a lot of rules for each of elements / bands / components?
(It must be somewhere some method as the designer does the same job..?!)
Thank you!
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: Runtime Style Loading
Hello,
Please check the following code:
https://www.stimulsoft.com/en/samples/r ... -from-code
Thank you.
Please check the following code:
https://www.stimulsoft.com/en/samples/r ... -from-code
Thank you.