Displaying Property Controls inside HTML Tables


In previous tips, we have discussed how you can add HTML directly into a Text Area.  To take this one step further, you may want to take Property Controls that you have already created and then add them into a HTML table or CSS positioning element to provide a more exact and better looking layout.  This tip will explain how that can be accomplished.

First, you should start by building the Property Controls which you wish to use.  This can include any combinations of the built-in Property Controls and Action Controls.

 
Then, using what you learned in the previous tip we mentioned, you will need to retrieve the HTML code that was generated for this Text Area, using a Script Control.


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

This will store the HTML Content in a input field (multiple line) Property Control:

 


 

Once you have the HTML content, you can now update it as you see fit: adding Tables, DIV tags, and styles. When you have the HTML content rewritten , you can now re-apply it back to the original text area.

This is done using another script, which takes the same input field Property Control as input and then rights the code back into the original Text Area to be rendered.

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


 

Once you do this, you will see the output includes the Property Controls inside an HTML table.

 

Intersted in learning more about Property Controls and other authoring features? Sign up for our Authoring Bootcamp. Sessions in both EMEA and North America are scheduled to start this week.