I am trying to export a Spotfire page into a PowerPoint presentation. I can export the charts in specific slides successfully but I can't add the page title in the TITLE section and the chart title in the SUBTITLE Section.
I am not sure whether it's possible or not. Can anyone kindly help me?
The current code is not adding anything in the TITLE section at all.
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
# LOOPING THROUGH ALL THE PAGES
# for page in Document.Pages:
# Document.ActivePageReference = page
page = Document.Pages[0]
Document.ActivePageReference = page
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
print(title)
print(page.Title)
txt=slide.Shapes.AddTextBox(1,10,500,500,100)
title.Top=0.1
obj=slide.Shapes.Title.TextFrame.TextRange
obj.Font.Size=24