Loading Custom Styles(.sts) in runtime

Stimulsoft Reports.JS discussion
Post Reply
damithfit
Posts: 3
Joined: Thu Nov 04, 2021 7:07 am

Loading Custom Styles(.sts) in runtime

Post by damithfit »

Hi,

I want to know how to load the custom style (.sts) file and apply it to the report designer's ''select style'' section using javascript.

in some post, you mentioned about the we can do it by some methods like,

loadFromJsonObject(jObject: StiJson)
loadFromXml(xmlNode: XmlNode)

but couldn't find any methods in JS documentation section.
https://admin.stimulsoft.com/documentat ... eport.html

Appreciate, if you could give some code examples of how we can achieve this using JavaScript.

thank you.

Regards,
damith
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Loading Custom Styles(.sts) in runtime

Post by Lech Kulikowski »

Hello,

You can save the necessary styles in JSON, XML and then use these methods to load it.

Thank you.
damithfit
Posts: 3
Joined: Thu Nov 04, 2021 7:07 am

Re: Loading Custom Styles(.sts) in runtime

Post by damithfit »

Hi Lech,

Thanks for the Reply.

Seems you didn't get me right.

Yeah, I got the style from JSON but I couldn't find any load methods in StiReport class in Javascript documentation.

something like report.style.loadFromJsonObject(JSON).

i can see mentioned methods(loadFromJsonObject(jObject: StiJson),loadFromXml(xmlNode: XmlNode)) in StiStyleCondition class. Please refer below link.

(https://admin.stimulsoft.com/documentat ... ition.html )

but I couldn't find any class or method for StiStylesCollection in Javascript documentation.

An early reply would be appreciated.

Thank you.

Regards,
damith
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Loading Custom Styles(.sts) in runtime

Post by Lech Kulikowski »

Hello,

You can use the following methods:
report.styles.loadFile("Styles.sts");
report.styles.loadFromJsonObject(jObject: StiJson)
report.styles.loadFromXml(xmlNode: XmlNode)
etc

Thank you.
damithfit
Posts: 3
Joined: Thu Nov 04, 2021 7:07 am

Re: Loading Custom Styles(.sts) in runtime

Post by damithfit »

Hi Lech,

Thanks for the reply.

Regards,
damith.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Loading Custom Styles(.sts) in runtime

Post by Lech Kulikowski »

Hello,

You are welcome.
Post Reply