如何在操作按钮上导出 PPT 文件中的 Tibco Spotfire 报告单击

How to export a Tibco Spotfire report in PPT file on the Action Button Click

我想在用户单击按钮时以 PPT 格式导出 Tibco Spotfire 报告。是否有任何 IronPython 脚本可以在动作触发时执行此操作?

这将打开 powerpoint 并每页导出一个可视化:

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

您可以循环浏览页面:

Document.Pages 中的页面: Document.ActivePageReference=页 根据此处找到的代码进行调整:https://tibbr.tibcommunity.com/tibbr/#!/messages/69369