Search
HyperlinkForm Class
Remarks See Also
 






Represents a form which can be used to create and modify cell hyperlinks in a worksheet.

Namespace: MindFusion.Spreadsheet.WinForms
Assembly: MindFusion.Spreadsheet.WinForms.StandardForms

 Syntax

C#  Copy Code

public class HyperlinkForm : Form

Visual Basic  Copy Code

Public Class HyperlinkForm
    Inherits Form

 Remarks

This form can be used to prompt the user for the hyperlink information of a worksheet cell. To use the form, create an instance of the HyperlinkForm class and call the ShowDialog method. The user's choice can be obtained from the Type, Target, SubTarget, and ToolTip properties. The following image shows the form:

 Example

The code below demonstrates how to use the form to edit the hyperlink of an existing cell.

C#  Copy Code

var form = new HyperlinkForm(cell.Hyperlink);
if (form.ShowDialog(this) == DialogResult.OK)
{
    using (workbook.StartChangeOperation(worksheet))
    {
        if (string.IsNullOrEmpty(form.Target))
        {
            cell.RemoveHyperlink();
        }
        else
        {
            if (cell.Hyperlink != null)
            {
                cell.Hyperlink.Type = form.Type;
                cell.Hyperlink.Target = form.Target;
                cell.Hyperlink.SubTarget = form.SubTarget;
            }
            else
            {
                cell.SetHyperlink(form.Type, form.Target, form.SubTarget);
            }

            cell.Hyperlink.ToolTip = form.ToolTip;
        }
    }
}

Visual Basic  Copy Code

Dim form = New HyperlinkForm(cell.Hyperlink)
If form.ShowDialog(Me) = DialogResult.OK Then

    Using workbook.StartChangeOperation(worksheet)

        If String.IsNullOrEmpty(form.Target) Then

            cell.RemoveHyperlink()

        Else

            If cell.Hyperlink IsNot Nothing Then
                cell.Hyperlink.Type = form.Type
                cell.Hyperlink.Target = form.Target
                cell.Hyperlink.SubTarget = form.SubTarget
            Else
                cell.SetHyperlink(form.Type, form.Target, form.SubTarget)
            End If

            cell.Hyperlink.ToolTip = form.ToolTip

        End If

    End Using

End If

 Inheritance Hierarchy

System.Object
    System.MarshalByRefObject
        System.ComponentModel.Component
            System.Windows.Forms.Control
                System.Windows.Forms.ScrollableControl
                    System.Windows.Forms.ContainerControl
                        System.Windows.Forms.Form
                            MindFusion.Spreadsheet.WinForms.HyperlinkForm

 See Also