Karthikeyan TS Posted March 22, 2016 Share Posted March 22, 2016 I need the users to export the data in table chart as excel on the click of a button from the text area. I need the detailed steps with a simple javascript/Iron Python to execyte the requirement. Require this help sincwe i am not exp in both iron python/js and with this i can build up my other requirements Link to comment Share on other sites More sharing options...
Pavan Lingam Posted March 23, 2016 Share Posted March 23, 2016 You may want to search for sample scripts in the older community forum (tibcommunity.spotfire.com). I remember seeing few posts on this requirement. Link to comment Share on other sites More sharing options...
Peter Bij Posted January 30, 2020 Share Posted January 30, 2020 Please refer to following page for a clear answer https://community.spotfire.com/wiki/how-export-data-tibco-spotfire-using-ironpython-script-and-c Link to comment Share on other sites More sharing options...
Tyger Guzman 2 Posted January 30, 2020 Share Posted January 30, 2020 The only method I've had work in both Desktop Client and Webplayer is using a JS to export HTML table to a CSV. In the below example I'm taking a cross table and exporting to a text area. Then from text area I am using a JS to export to csv. Python #Converts a tablePlot to an html table and adds export functionality. Works in webplayer and any browser that supports flash # to POC, Add a data table and two text areas. Then define the two script parameters: # visTA : target text area (a blank text area different from where this script will running as it will replace its contents) # visDT : Data Table visualization from Spotfire.Dxp.Application.Visuals import TablePlot, HtmlTextArea ta = visTA.As[HtmlTextArea]() from System.IO import Path, StreamWriter from System.Text import StringBuilder #Temp file for storing the cross table data tempFolder = Path.GetTempPath() tempFilename = Path.GetTempFileName() #Export TablePlot data to the temp file tp = visDT.As[TablePlot]() writer = StreamWriter(tempFilename) tp.ExportText(writer) #Build the table sb = StringBuilder() #Open the temp file for reading f = open(tempFilename) #add some scripting magic from CDN html = ' Page Title Export' #build the html table html += " n" html += "" html += " " html += " ".join(f.readline().split("t")).strip() html += " " html += "n" html += "n" for line in f: html += "" html += "".join(line.split("t")).strip() html += "n" f.close() html += "n" html += "n Double Click Here To View Details" ta.HtmlContent = htmlHTML : Export Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now