nagarajareddy aturi Posted May 6 Share Posted May 6 Hi Everyone? I want to use a script to add a Button for Export Power point slides pf my Spotfire dashboard, I know that Spotfire is providing an Option for Export Pdf and Export Power Point (File-> Menu Bar), Somehow users are unable to access menu bar in Web Player, We have to write a Script to add this functionality. Could you please help me on this? Thanks in Advance . Link to comment Share on other sites More sharing options...
David Boot-Olazabal Posted May 6 Share Posted May 6 Hi Nagarajareddy, If users are unable to see the Menu bar, it may have been hidden from them. One of the privileges that can be granted to users, is the Export to PowerPoint one: If this is not granted, users will not be able to see the menu option for the PowerPoint export. If, for some reason, it is not possible to fix that, then a script could be the solution. You can find an iron python example script here. You may need to tweak that script, according to the Spotfire version in use. Kind regards, David Link to comment Share on other sites More sharing options...
nagarajareddy aturi Posted May 6 Author Share Posted May 6 Hi @David Boot-Olazabal Thanks for your prompt response, My users don't access the dashboards through Web player, They have their own Platform (Commerce) which is integrated with Spotfire, They are accessing the dashboards through commerce, So when they are trying to access through commerce Spotfire Menu bar will not show due to commerce is having different UI setup , So we have only option to use script, I found a script for Export PDF, Its working fine but unable to get a script for Export Power point, I was tried whatever available in Online, I am tried my best but couldn't achieve, Could you please share your inputs? Thank you. Link to comment Share on other sites More sharing options...
David Boot-Olazabal Posted May 7 Share Posted May 7 Hi Nagarajareddy, My bad, I referenced a wrong page in my first reply. Regarding the user set up, yes, it makes sense that they don't have the menu bar available since it is embedded in a different application. I have found this code, which exports the visualizations on the page. It works from the Analyst client, if you uncheck the box. import clr clr.AddReference("System.IO") from System.IO import * from Spotfire.Dxp.Application.Visuals import VisualContent from System.Drawing import Bitmap, Graphics, Rectangle, Point clr.AddReference("Microsoft.Office.Interop.PowerPoint") import Microsoft.Office.Interop.PowerPoint as PowerPoint powerpoint = PowerPoint.ApplicationClass() powerpoint.Visible = True pres=powerpoint.Presentations.Add() slideCounter = 1 for visual in Document.ActivePageReference.Visuals: #print visual.Title #export graphic to temp file vc = visual.As[VisualContent]() bm = Bitmap(2000, 1200) g = Graphics.FromImage(bm) r = Rectangle(Point(0,0), bm.Size) vc.Render(g, r) file = Path.GetTempFileName() bm.Save(file) #pp setup slide=pres.Slides.Add(slideCounter, PowerPoint.PpSlideLayout.ppLayoutTitleOnly) slideCounter = slideCounter+1 slide.Shapes.AddPicture((file), False, True, 30, 60, 650, 400) title=slide.Shapes.Title txt=slide.Shapes.AddTextBox(1,10,500,500,100) title.Top=0.1 obj=slide.Shapes.Title.TextFrame.TextRange obj.Font.Size=24 Kind regards, David Link to comment Share on other sites More sharing options...
nagarajareddy aturi Posted May 7 Author Share Posted May 7 Hi @David Boot-Olazabal, Thanks for your response, I have already tried to implement this script, it's working fine in analyst and somehow it's not working in web player. Could you please help me how can we modify this script to work in web player else please suggest if any other script that I can use, Thanks in advance. Link to comment Share on other sites More sharing options...
Prateek Rawat 3 Posted August 1 Share Posted August 1 On 5/7/2024 at 11:54 AM, David Boot-Olazabal said: Hi Nagarajareddy, My bad, I referenced a wrong page in my first reply. Regarding the user set up, yes, it makes sense that they don't have the menu bar available since it is embedded in a different application. I have found this code, which exports the visualizations on the page. It works from the Analyst client, if you uncheck the box. import clr clr.AddReference("System.IO") from System.IO import * from Spotfire.Dxp.Application.Visuals import VisualContent from System.Drawing import Bitmap, Graphics, Rectangle, Point clr.AddReference("Microsoft.Office.Interop.PowerPoint") import Microsoft.Office.Interop.PowerPoint as PowerPoint powerpoint = PowerPoint.ApplicationClass() powerpoint.Visible = True pres=powerpoint.Presentations.Add() slideCounter = 1 for visual in Document.ActivePageReference.Visuals: #print visual.Title #export graphic to temp file vc = visual.As[VisualContent]() bm = Bitmap(2000, 1200) g = Graphics.FromImage(bm) r = Rectangle(Point(0,0), bm.Size) vc.Render(g, r) file = Path.GetTempFileName() bm.Save(file) #pp setup slide=pres.Slides.Add(slideCounter, PowerPoint.PpSlideLayout.ppLayoutTitleOnly) slideCounter = slideCounter+1 slide.Shapes.AddPicture((file), False, True, 30, 60, 650, 400) title=slide.Shapes.Title txt=slide.Shapes.AddTextBox(1,10,500,500,100) title.Top=0.1 obj=slide.Shapes.Title.TextFrame.TextRange obj.Font.Size=24 Kind regards, David This script exports one visual per slide, is it possible to export the active page in one slide? 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