Spread Windows Forms 7.0 Product Documentation
LinkAreas Property
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.CellType Namespace > HyperLinkCellType Class : LinkAreas Property


Glossary Item Box

Gets or sets the area of the text that is the hyperlink.

Syntax

Visual Basic (Declaration) 
Public Property LinkAreas As LinkArea()
Visual Basic (Usage)Copy Code
Dim instance As HyperLinkCellType
Dim value() As LinkArea
 
instance.LinkAreas = value
 
value = instance.LinkAreas
C# 
public LinkArea[] LinkAreas {get; set;}

Property Value

LinkArea array containing the LinkArea objects that defines the location of the hyperlinks within the link text

Exceptions

ExceptionDescription
System.ArgumentException Specified start is invalid; must be positive
System.ArgumentException Specified length is invalid; must be positive
System.ArgumentException Specified length is invalid; must be less than or equal to the length of the entire text

Remarks

Refer to the LinkArea example to understand how to specify an individual hyperlink.

For multiple hyperlinks in one text string, use this property that allows you to specify an array of individual hyperlinks along with the Links property. Remember character positions in the string are zero-indexed; the first character is at position 0.

For example, "Visit our main site or our tech support site." has 45 characters counting the spaces betwen words and the period at the end of the string. To underline and make part of the hyperlink only the words "main site", use LinkArea(10,9); in other words, start at the 11th character in the string and make 9 characters underlined and clickable. Then, in addition to have the words "tech support site" linkable, use LinkArea(27,17) so the link would start at the 28th character and underline 17 characters. Then the LinkAreas property would use both of the LinkArea objects in the array.

To find the entire length of the text string, use the Text.Length property.

Example

This example creates a multiple hyperlink cell.
C#Copy Code
FarPoint.Win.Spread.CellType.HyperLinkCellType mhp = new FarPoint.Win.Spread.CellType.HyperLinkCellType(); 
mhp.Text = "Visit our main site or our tech support site."; 
string[] s = new string[]{"www.fpoint.com", "www.clubfarpoint.com"};  
mhp.Links = s; 
LinkArea[] la = new LinkArea[]{new LinkArea(10, 9), new LinkArea(27, 17)}; 
mhp.LinkAreas = la; 
fpSpread1.ActiveSheet.Columns[1].Width = 220;
fpSpread1.ActiveSheet.Cells[0, 0].CellType = mhp;
Visual BasicCopy Code
Dim mhp As New FarPoint.Win.Spread.CellType.HyperLinkCellType
mhp.Text = "Visit our main site or our tech support site."
Dim s() As String = New String() {"www.fpoint.com", "www.clubfarpoint.com"} 
mhp.Links = s 
Dim la() As LinkArea = New LinkArea() {New LinkArea(10, 9), New LinkArea(27, 17)} 
mhp.LinkAreas = la 
FpSpread1.ActiveSheet.Columns(1).Width = 220
FpSpread1.ActiveSheet.Cells(0, 0).CellType = mhp

Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.