Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Description

Excerpt

This class represents a hyperlink field in a document.

Signature
C#
C#
 public sealed class Hyperlink : Field
{signature}{signature:
}
Signature
vb.net
vb.net
Public NotInheritable Class Hyperlink
		Inherits Field
{signature}
{remarks}To create a hyperlink, use [
Remarks

To create a hyperlink, use Element.InsertHyperlinkBefore()

|Element

.

InsertHyperlinkBefore(String, String)].

To

get

the

hyperlinks

in

a

[

Document

|Document]

,

use

the

[

Element.GetElements()

|Element.GetElements(Element.Type)]

method

with

a

[

Element.Type.Hyperlink

|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.

{remarks} {example}{code:csharp|title=C#}

Example
Code Block
csharp
csharp
titleC#


          //--- 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.GetElements(Element.Type.Hyperlink)[0];
        
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}


          '--- 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.GetElements(Element.Type.Hyperlink)(0)
        
{code} {example} {methods} ||Name||Description|| |[GetUrlString()|
Methods

Name

Description

GetUrlString()

Excerpt Include
Hyperlink.GetUrlString()

...

Hyperlink.GetUrlString()

...

nopanel

...

true

...