SetExternalHyperlinkClick
HyperlinkManager.SetExternalHyperlinkClick 方法
设置点击时的外部超链接。
public IHyperlink SetExternalHyperlinkClick(string url)
参数 | 类型 | 描述 |
---|---|---|
url | String | 超链接 URL。 |
示例
以下示例代码展示了如何添加带有超链接的文本框。
[C#]
// 实例化一个表示 PPTX 的 Presentation 类
using(Presentation pptxPresentation = new Presentation()) {
// 获取展示文稿中的第一张幻灯片
ISlide slide = pptxPresentation.Slides[0];
// 添加一个类型设为矩形的 AutoShape 对象
IShape pptxShape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 150, 150, 150, 50);
// 将形状转换为 AutoShape
IAutoShape pptxAutoShape = (IAutoShape) pptxShape;
// 访问与 AutoShape 关联的 ITextFrame 属性
pptxAutoShape.AddTextFrame("");
ITextFrame textFrame = pptxAutoShape.TextFrame;
// 向框架添加一些文本
textFrame.Paragraphs[0].Portions[0].Text = "Aspose.Slides";
// 设置部分文本的超链接
IHyperlinkManager HypMan = textFrame.Paragraphs[0].Portions[0].PortionFormat.HyperlinkManager;
HypMan.SetExternalHyperlinkClick("http://www.aspose.com");
// 保存 PPTX 演示文稿
pptxPresentation.Save("hLinkPPTX_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}
另见
- 接口 IHyperlink
- 类 HyperlinkManager
- 命名空间 Aspose.Slides
- 程序集 Aspose.Slides