HotXLS Belgeleri

TXLSXHyperlinks / TXLSXHyperlink classes

Hyperlink support on a TXLSXWorksheet. Each entry anchors a single cell to an external URL. SaveAs emits a <hyperlinks> block in the worksheet plus a matching xl/worksheets/_rels/sheetN.xml.rels dosyası; Open, relationship hedeflerini koleksiyona geri çözümler. Bildirildiği yer: lxHandleX

TXLSXHyperlink declaration

type
  TXLSXHyperlink = class
    constructor Create(ARow, ACol: Integer; const AUrl, ADisplay, ATooltip: WideString);
    function IsInternal: Boolean;     // True when Location is set and Url is empty
    property Row: Integer;
    property Col: Integer;
    property Url: WideString;        // External URL (mutually exclusive with Location)
    property Location: WideString;   // Internal anchor, e.g. "Sheet2!A1"
    property Display: WideString;
    property Tooltip: WideString;
  end;
      

TXLSXHyperlink üyeleri

Row, Col 1-based cell anchor coordinates
Url External URL. Written to sheetN.xml.rels with TargetMode="External"
Display Optional display text shown by Excel in place of the URL. Maps to the display attribute on <hyperlink>
Tooltip Optional tooltip shown when the user hovers the cell. Maps to the tooltip attribute on <hyperlink>

TXLSXHyperlinks declaration

type
  TXLSXHyperlinks = class
    constructor Create;
    destructor Destroy; override;
    function Add(ARow, ACol: Integer; const AUrl: WideString): Integer; overload;
    function Add(ARow, ACol: Integer; const AUrl, ADisplay: WideString): Integer; overload;
    function Add(ARow, ACol: Integer; const AUrl, ADisplay, ATooltip: WideString): Integer; overload;
    // Internal hyperlink — Location overload. No rels relationship.
    function AddInternal(ARow, ACol: Integer; const ALocation, ADisplay, ATooltip: WideString): Integer;
    function IndexOfCell(ARow, ACol: Integer): Integer;
    function FindAt(ARow, ACol: Integer): TXLSXHyperlink;
    function DeleteAt(ARow, ACol: Integer): Boolean;
    function DeleteInRange(ARow1, ACol1, ARow2, ACol2: Integer): Integer;
    procedure Delete(Index: Integer);
    procedure Clear;
    property Count: Integer;
    property Items[Index: Integer]: TXLSXHyperlink; default;
  end;
      

TXLSXHyperlinks üyeleri

Add(Row, Col, Url) Adds a hyperlink with just a URL. Döndürür the new entry index
Add(Row, Col, Url, Display) Adds a hyperlink with an explicit display text
Add(Row, Col, Url, Display, Tooltip) Adds a hyperlink with both display text and tooltip
AddInternal(Row, Col, Location, Display, Tooltip) Adds an internal anchor hyperlink — jumps to a Sheet!Cell location (e.g "Sheet2!A1") elsewhere in the workbook. No worksheet rels relationship is generated; the <hyperlink> element carries an inline location attribute. Use Worksheet.AddHyperlinkToCell(...) for the typical shortcut
IndexOfCell(Row, Col) Döndürür the 0-based index of the hyperlink anchored at the 1-based cell coordinate, or -1 when the cell has no hyperlink
FindAt(Row, Col) Döndürür the hyperlink object anchored at the cell, or nil when no hyperlink is present
DeleteAt(Row, Col) Deletes the hyperlink anchored at the cell and returns True; returns False when no matching hyperlink exists
DeleteInRange(Row1, Col1, Row2, Col2) Çapası 1 tabanlı, uçları dahil hücre aralığının içinde kalan her köprüyü siler ve kaldırılan sayıyı döndürür. Ters çevrilmiş koordinatlar kabul edilir
Delete(Index) Deletes the hyperlink at the specified 0-based collection index
Count Number of hyperlinks on the worksheet
Items[Index] Hyperlink at the given 0-based index. Declared as the default property
Clear Removes and frees every hyperlink

Örnek

var
  ws: TXLSXWorksheet;
begin
  ws := Workbook.Sheets.Add('Links');

  ws.Cells.Item[1, 1].Value := 'losLab';
  ws.AddHyperlink(1, 1, 'https://www.loslab.com',
                  'losLab home', 'Open in browser');

  // Equivalent through the collection:
  ws.Hyperlinks.Add(2, 1, 'https://www.loslab.com/docs');

  if ws.Hyperlinks.FindAt(1, 1) <> nil then
    ws.Hyperlinks.DeleteInRange(1, 1, 2, 1);
end;
    

Ayrıca bkz.