Customer Banners (Ads) - SpiceUp. AX and SpotfireX Disclaimer



If you find this site useful and you want to support, buy me a coffee   to keep this site alive and without ads.

Html in TextArea

#This is a very powerful script as you can include html from a document property to update a text area:

from Spotfire.Dxp.Application.Visuals import HtmlTextArea
vis = ta.As[HtmlTextArea]()
vis.HtmlContent = Document.Properties["HtmlInput"]

More details here

3 comments:

Unknown said...

You could also use a string replace command. Would be useful for an if statement based on a document property.

from Spotfire.Dxp.Application.Visuals import HtmlTextArea
vis = ta.As[HtmlTextArea]()
str = vis.HtmlContent
str = str.replace("Apple","Banana")
vis.HtmlContent = str

philipp said...

copy/pasting exactly the original script (only changing the name of my document property) i get the following error:

Traceback (most recent call last):
File "Spotfire.Dxp.Application.ScriptSupport", line unknown, in ExecuteForDebugging
File "", line 2, in
NameError: name 'ta' is not defined

how can this be fixed? thank you so much!

Jose Leviaguirre said...

Phillip, ta is a script parameter that points to a text area. The script above replaces the entire content of the text area. As jeff said, you can replace portion of it by using a replace function.