首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在操作按钮单击PPT文件中导出Tibco Spotfire报告

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

Stack Overflow用户
提问于 2015-12-17 06:59:44
回答 1查看 2.5K关注 0票数 1

当用户单击Button时,我希望导出PPT格式的Tibco Spotfire报告。是否有任何IronPython脚本可以作为动作触发来执行此操作?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-12-17 17:01:30

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

代码语言:javascript
复制
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=page:https://tibbr.tibcommunity.com/tibbr/#!/messages/69369

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34328478

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档