翻譯|使用教程|編輯:李顯亮|2020-10-14 10:54:58.673|閱讀 399 次
概述:本文將介紹如何使用Spire.Presentation for .NET給PPT文檔中的SmartArt圖形的節點添加超鏈接。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Spire.Presentation for .NET 是專業的 PowerPoint組件,開發者可以在 .NET 平臺上對 PPT文檔進行生成、修改、轉換和打印等操作,而無需安裝 Microsoft PowerPoint。
本文將介紹如何使用Spire.Presentation for .NET給PPT文檔中的SmartArt圖形的節點添加超鏈接。可點擊此處下載最新版測試。
C#
using Spire.Presentation; using Spire.Presentation.Diagrams; namespace SmartArt { class Program { static void Main(string[] args) { //創建Presentation實例 Presentation ppt = new Presentation(); //加載PPT文檔 ppt.LoadFromFile("SmartArt.pptx"); //獲取第一張幻燈片 ISlide slide = ppt.Slides[0]; //獲取SmartArt圖形 ISmartArt smartArt = slide.Shapes[0] as ISmartArt; //添加指向網頁的超鏈接到SmartArt圖形的第一個節點 smartArt.Nodes[0].Click = new ClickHyperlink("http://www.e-iceblue.com"); //添加指向文檔中指定幻燈片的超鏈接到SmartArt圖形的第二個節點 smartArt.Nodes[1].Click = new ClickHyperlink(ppt.Slides[1]); //保存結果文檔 ppt.SaveToFile("Result.pptx", FileFormat.Pptx2013); } } }
VB.NET
Imports Spire.Presentation Imports Spire.Presentation.Diagrams Namespace SmartArt Class Program Private Shared Sub Main(ByVal args As String()) Dim ppt As Presentation = New Presentation() ppt.LoadFromFile("SmartArt.pptx") Dim slide As ISlide = ppt.Slides(0) Dim smartArt As ISmartArt = TryCast(slide.Shapes(0), ISmartArt) smartArt.Nodes(0).Click = New ClickHyperlink("http://www.e-iceblue.com") smartArt.Nodes(1).Click = New ClickHyperlink(ppt.Slides(1)) ppt.SaveToFile("Result.pptx", FileFormat.Pptx2013) End Sub End Class End Namespace
效果圖
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn