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