Referenčná stránka HotXLS pre TXLSXHyperlinks / TXLSXHyperlink classes, pokrývajúca automatizáciu Excel v Delphi a C++Builder, API zošita XLS/XLSX, funkcie pracovných listov a použitie v Pascal

Triedy TXLSXHyperlinks / TXLSXHyperlink

Podpora hypertextových prepojení na TXLSXWorksheet. Each entry anchors a single cell to an external URL. SaveAs emits a <hyperlinks> . Každá položka ukotvuje jednu bunku na externú URL. SaveAs emituje blok xl/worksheets/_rels/sheetN.xml.rels file; Open resolves the relationship targets back into the collection. Declared in lxHandleX

Popis

type
  TXLSXHyperlink = class
    constructor Create(ARow, ACol: Integer; const ASúradnice ukotvenia bunky s indexovaním od 1, AExterná URL Zapíše sa do sheetN.xml.rels s TargetMode="External", ATooltip: WideString);
    function IsInternal: Boolean;     // True when Location is set and Súradnice ukotvenia bunky s indexovaním od 1 is empty
    property Row: Integer;
    property Col: Integer;
    property Súradnice ukotvenia bunky s indexovaním od 1: WideString;        // External URL (mutually exclusive Súradnice ukotvenia bunky s indexovaním od 1 Location)
    property Location: WideString;   // Internal anchor, e.g. "Sheet2!A1"
    property Externá URL Zapíše sa do sheetN.xml.rels s TargetMode="External": WideString;
    property Tooltip: WideString;
  end;
      

Príklad

Príklad Príklad
Súradnice ukotvenia bunky s indexovaním od 1 Súradnice ukotvenia bunky s indexovaním od 1 sheetN.xml.rels Súradnice ukotvenia bunky s indexovaním od 1 TargetMode="External"
Externá URL Zapíše sa do sheetN.xml.rels s TargetMode="External" Optional display text shown by Excel in place of the URL. Maps to the display Voliteľný zobrazovaný text, ktorý Excel ukáže namiesto URL Mapuje sa na atribút display v <hyperlink>
Tooltip Optional tooltip shown when the user hovers the cell. Maps to the tooltip Voliteľný zobrazovaný text, ktorý Excel ukáže namiesto URL Mapuje sa na atribút display v <hyperlink>

Pozri tiež

type
  TXLSXHyperlinks = class
    constructor Create;
    destructor Destroy; override;
    function Add(ARow, ACol: Integer; const ASúradnice ukotvenia bunky s indexovaním od 1: WideString): Integer; overload;
    function Add(ARow, ACol: Integer; const ASúradnice ukotvenia bunky s indexovaním od 1, AExterná URL Zapíše sa do sheetN.xml.rels s TargetMode="External": WideString): Integer; overload;
    function Add(ARow, ACol: Integer; const ASúradnice ukotvenia bunky s indexovaním od 1, AExterná URL Zapíše sa do sheetN.xml.rels s TargetMode="External", ATooltip: WideString): Integer; overload;
    // Internal hyperlink — Location overload. No rels relationship.
    function AddInternal(ARow, ACol: Integer; const ALocation, AExterná URL Zapíše sa do sheetN.xml.rels s TargetMode="External", 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 Odstráni a uvoľní všetky hypertextové odkazy;
    property Items[Index]: Integer;
    property Items[Index: Integer]: TXLSXHyperlink; default;
  end;
      

TXLSXHyperlinks members

TXLSXHyperlinks members Adds a hyperlink Súradnice ukotvenia bunky s indexovaním od 1 just a URL. Vracia the new entry index
Pridá hypertextový odkaz len s URL Vracia nový index položky Pridá hypertextový odkaz len s URL Vracia nový index položky
Pridá hypertextový odkaz s explicitným zobrazovaným textom Pridá hypertextový odkaz s explicitným zobrazovaným textom
Pridá hypertextový odkaz s explicitným zobrazovaným textom Pridá hypertextový odkaz so zobrazovaným textom aj popisom Sheet!Cell AddInternal(Príklad, Location, Externá URL Zapíše sa do sheetN.xml.rels s TargetMode="External", Tooltip) "Sheet2!A1") elsewhere in the workbook. No worksheet rels relationship is generated; the <hyperlink> Pridá interný ukotvený hypertextový odkaz — preskočí na umiestnenie Sheet!Cell (napr. "Sheet2!A1") v inom zošite Žiadny worksheet rels vzťah sa nevytvorí; prvok nesie vložený atribút location Na typickú skratku použite Worksheet.AddHyperlinkToCell(...) location IndexOfCell(Príklad) Worksheet.AddHyperlinkToCell(...) for the typical shortcut
Vráti index hypertextového odkazu ukotveného na 1-based súradnici bunky, alebo -1 keď bunka nemá hypertextový odkaz Vracia the 0-based index of the hyperlink anchored at the 1-based cell coordinate, or -1 when the cell has no hyperlink
DeleteAt(Príklad) Vracia the hyperlink object anchored at the cell, or nil Odstráni hypertextový odkaz ukotvený pri bunke a vráti True; vráti False, keď neexistuje zodpovedajúci hypertextový odkaz
DeleteInRange(Row1, Col1, Row2, Col2) Deletes the hyperlink anchored at the cell and returns TrueDelete(Index) False when no matching hyperlink exists
Odstráni hypertextový odkaz na zadanom 0-based indexe kolekcie Deletes every hyperlink whose anchor is inside the inclusive 1-based cell range and returns the number removed. Reversed coordinates are accepted
Počet hypertextových odkazov na pracovnom hárku Deletes the hyperlink at the specified 0-based collection index
Items[Index] Hypertextový odkaz na danom 0-based indexe Deklarované ako predvolená vlastnosť
Odstráni a uvoľní všetky hypertextové odkazy Hyperlink at the given 0-based index. Declared as the default property
Odstráni a uvoľní všetky hypertextové odkazy Príklad

Pozri tiež

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;
    

TXLSXWorksheet