Yacine El Gharbi Posted February 25, 2019 Share Posted February 25, 2019 Hi! I've been searching in the community on how to export images from spotfire via Ironpython. It seems that everyone is talking about the exporting to a power point file. In my project Word is more convenient! Is it possible to write a script that export the viusalizations from spotfire to a word template Please share your ideas in this matter! Thank you. Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted February 25, 2019 Share Posted February 25, 2019 There is no direct API available in Spotfire to export an image to Word. One workaround is may be to export the image to a folder and then use the Microsoft API for Word document (if new) to create a new file and add these images. Below is a sample script on how to export images from Spotfire.Dxp.Application.Visuals import * from System.Drawing import Size from System.Threading import CancellationToken from Spotfire.Dxp.Application.Visuals import RenderResultSettings s=Size(500,500) rrs=RenderResultSettings(s) vrs=VisualRenderSettings() vrs.ShowAnnotations=Visibility.Visible vrs.ShowLegend=Visibility.Visible vrs.ShowTitle=Visibility.Visible ct=CancellationToken() #viz is a script parameter referencing the visualization to be exported rresult=viz.RenderAsync(rrs,vrs,ct) img=rresult.Result.AsImage() img.Save("C://temp//viz.png") #Note - "Execute in transaction" checkbox is unchecked before running the script https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-a... https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-a... https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-a... Link to comment Share on other sites More sharing options...
Yacine El Gharbi Posted February 26, 2019 Author Share Posted February 26, 2019 Thank you Shandilya! So the API you mentioned allows you exporting images from a folder to a word document! Can you please indicate which API you are talking about And is it available in all versions or just the latest (i'm using 7.10). Thank you so much Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted February 27, 2019 Share Posted February 27, 2019 The script I shared will export the visualization as an Image this is all part of the Spotfire API. but there is no Spotfire API to create a word document. So once images are exported , I was suggesting for you to check if there is any API avaialble from Microsoft which allows to create a word document and providing the images from Spotfire.Then you can add also those into the IronPython script before and test. Something like this may be,https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.word.applicationclassview=word-pia 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