[英]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 = page從此處找到的代碼調整: https : //tibbr.tibcommunity.com/tibbr/#!/messages/69369
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.