Jump to content

Export to Microsoft PowerPoint


Massimo Bianchi

Recommended Posts

As informed earlier, Spotfire does not expose any of the Power Point export functions in the public APIs.

A possible option you have is to implement this functionality by yourself. The below link might help:

http://stackoverflow.com/questions/31731159/script-to-export-spotfire-gr...

==========================================

This will open up powerpoint and export one visualisation per page:

 

from System.IO import *

from Spotfire.Dxp.Application.Visuals import VisualContent

from System.Drawing import Bitmap, Graphics, Rectangle, Point

import clr

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

==========================================

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...