Skip to main content

TdxSpreadSheetHyperlinks.Add(Integer,Integer) Method

Creates a new hyperlink on the parent worksheet.

Declaration

function Add(const ARow: Integer; const AColumn: Integer): TdxSpreadSheetHyperlink; reintroduce; overload;

Parameters

Name Type
ARow Integer
AColumn Integer

Returns

Type
TdxSpreadSheetHyperlink

Remarks

You can call any of these overloaded function variants to create a new hyperlink and add it to the collection. Different Add function variants allow you to specify the returned hyperlink’s hot area in different ways:

Variant

Description

1

The function variant accepts a TRect value as the AArea parameter. The value indicates the cell range that newly created hyperlink’s hot area occupies.

Pass the Rect(-1, -1, -1, -1) value as the AArea parameter instead of a valid rectangle if you need to create a hyperlink without a cell range as a hot area. In this case, the first function variant is particularly useful if you need to assign a new hyperlink only to a floating shape, picture, text box, or comment container on the parent worksheet.

2

The function variant accepts a reference (as a string in the A1 format) to a cell or cell range that the newly created hyperlink uses as its hot area. If the specified reference does not correspond to a valid cell range, an Add function call raises the EdxSpreadSheetError exception. You can use the sdxErrorInvalidCellsReference resource string to localize the exception’s message.

3

The function variant accepts the row and column indexes of a single target cell as the ARow and AColumn parameters, respectively.

The following code example shows how to use a floating container as a hyperlink’s hot area without an additional hot area associated with a cell range:

var
  ATableView: TdxSpreadSheetTableView;
  AShapeContainer: TdxSpreadSheetShapeContainer;
  AHyperlink: TdxSpreadSheetHyperlink;
//...
  ATableView := dxSpreadSheet1.ActiveSheetAsTable;
  AShapeContainer := ATableView.Containers.Add(TdxSpreadSheetShapeContainer) as TdxSpreadSheetShapeContainer;  // Creates a new floating shape container in the parent worksheet
  AHyperlink := ATableView.Hyperlinks.Add(Rect(-1, -1, -1, -1));  // Creates a new hyperlink without a hot area on the parent worksheet
  AShapeContainer.Hyperlink := AHyperlink;  // Connects the newly created hyperlink to the floating shape container
See Also