|
Programmer's Reference >
WordApplication API >
Hyperlink
The Hyperlink Object
This class represents a hyperlink field in a document. To create a hyperlink, use Element.InsertHyperlinkBefore(). To get the hyperlinks in a Document, use the Element.Elements property with a Element.Type.Hyperlink parameter. The following sample demonstrates creating a hyperlink at the end of a new document and retrieving the first hyperlink of an existing document.
Examples:
[csharp]
// Add a hyperlink to a document
WordApplication app = new WordApplication();
Document doc = app.Open(@"C:\sample.doc");
Hyperlink link = doc.InsertHyperlinkAfter("http://www.softartisans.com", "SoftArtisans");
// Get the first hyperlink from a document
WordApplication app = new WordApplication();
Document doc = app.Open(@"C:\sample.doc");
Hyperlink firstLink = doc.Elements(Element.Type.Hyperlink)[0];
[vbnet]
' Add a hyperlink to a document
Dim app As New WordApplication()
Dim doc As Document = app.Open("C:\sample.doc")
Dim link As Hyperlink = doc.InsertHyperlinkAfter("http://www.softartisans.com", "SoftArtisans")
' Get the first hyperlink from a document
Dim app As New WordApplication()
Dim doc As Document = app.Open("C:\sample.doc")
Dim link As Hyperlink = doc.Elements(Element.Type.Hyperlink)(0)
Please note that this object inherits methods and properties not shown here from the following objects:
This object does not have any properties defined.
Hyperlink Methods
| Returns | Signature and Description |
|
String
|
GetUrlString ( )
Returns the URL that the hyperlink points to.
|

Copyright 2007 © SoftArtisans, Inc. All Rights Reserved.
|