TX Text Control .NET Server

Remove Method

Method
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK as TXTextControl.Core.dll from the private NuGet feed or Text Control Offline Packages
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

Description

Removes a hypertext link from a Text Control document.

Syntax

Remove(HypertextLink)

Removes a hypertext link including its visible text from a Text Control document.

public bool Remove(HypertextLink hypertextLink);
ParameterDescription
hypertextLink

Specifies the hypertext link to remove.

Remove(HypertextLink, bool)

Removes a hypertext link from a Text Control document. The visible text is deleted depending on the keepText parameter.

public bool Remove(HypertextLink hypertextLink, bool keepText);
ParameterDescription
hypertextLink

Specifies the hypertext link to remove.

keepText

If this parameter is set to true, the hypertext link is removed without deleting its text. Otherwise, the link's text is also deleted.

Return Value

The return value is true, if the hypertext link could be removed. Otherwise it is false.

Examples

The following example works with hypertext links in the current document by using HypertextLinkCollection.Remove.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
HypertextLinkCollection hypertextLinkCollection = textControl.HypertextLinks;
hypertextLinkCollection.Add(new HypertextLink("Documentation", "https://docs.textcontrol.com/") { ID = 100 });

if (hypertextLinkCollection.Count > 0)
{
    HypertextLink hypertextLink = hypertextLinkCollection[1];
    if (hypertextLinkCollection.Remove(hypertextLink))
    {
        Console.WriteLine("The item was removed.");
    }
}