[]
Iterable<IHyperlink>Each hyperlink in the collection is represented by an IHyperlink object. Use this interface to add, access, iterate, or delete hyperlinks that are attached to a worksheet, a cell, a range, or a shape.
IHyperlinks hyperlinks = worksheet.getRange("A1:B2").getHyperlinks();
hyperlinks.add(worksheet.getRange("A1"), "https://www.example.com/", null, "Open website", "Example");
IHyperlink hyperlink = hyperlinks.get(0);
IHyperlink object).IHyperlink object).IHyperlink object).IHyperlink object).voiddelete()get(int index) IHyperlink by index.intgetCount()forEach, iterator, spliteratorIHyperlink by index.The index is zero-based. If the index is outside the collection, this method returns null.
IHyperlinks hyperlinks = worksheet.getHyperlinks();
hyperlinks.add(worksheet.getRange("A1"), "https://www.example.com");
IHyperlink hyperlink = hyperlinks.get(0);
index - The zero-based index of the hyperlink.IHyperlink object at the specified index, or null if the index is outside the collection.For an IHyperlinks collection, this value indicates how many IHyperlink objects are contained in the worksheet or range.
IRange range = worksheet.getRange("A1:A2");
range.getHyperlinks().add(worksheet.getRange("A1"), "https://www.example.com");
int count = range.getHyperlinks().getCount();
IHyperlink objects in the collection.IHyperlink object).Use this method to attach a hyperlink to the specified anchor range.
IHyperlinks hyperlinks = worksheet.getHyperlinks();
worksheet.getRange("A1").setValue("Example");
IHyperlink hyperlink = hyperlinks.add(worksheet.getRange("A1"), "https://www.example.com");
anchor - The IRange that serves as the hyperlink anchor. Must not be null.address - The hyperlink address. Must not be null.IHyperlink object.IHyperlink object).Use this overload to specify the hyperlink address together with an optional subaddress, screen tip, and display text.
IRange range = worksheet.getRange("A1:A2");
IHyperlink hyperlink = range.getHyperlinks().add(
worksheet.getRange("A1"),
"https://www.example.com",
null,
"Open example",
"Example");
anchor - The IRange that serves as the anchor for the hyperlink.address - The hyperlink address. This value can be null when the target is specified by subAddress.subAddress - The subaddress of the hyperlink. This value is optional and can be null.screenTip - The screen tip displayed when the mouse pointer pauses over the hyperlink. This value is optional and can be null.textToDisplay - The text displayed for the hyperlink. Pass an empty string to use the default display text.IHyperlink object.IHyperlink object).Use this method to attach a hyperlink address to a shape on the worksheet.
IShape shape = worksheet.getShapes().addShape(AutoShapeType.Oval, 10, 10, 120, 60);
shape.getTextFrame().getTextRange().add("Example");
IHyperlink hyperlink = worksheet.getHyperlinks().add(shape, "https://www.example.com");
shape - The IShape for the hyperlink.address - The address of the hyperlink.IHyperlink object.IHyperlink object).Use this method to attach a hyperlink to a shape such as an auto shape, chart, connector, picture, or group shape. The hyperlink target is defined by address and subAddress, and the optional screen tip and display text can be used to customize the user-facing content.
IShape shape = worksheet.getShapes().addShape(AutoShapeType.Oval, 10, 10, 120, 40);
IHyperlinks hyperlinks = worksheet.getHyperlinks();
IHyperlink hyperlink = hyperlinks.add(
shape, "https://www.example.com", null, "Open example", "Example");
shape - The shape for the hyperlink.address - The hyperlink address. This value can be null when the target is specified by subAddress.subAddress - The location within the target document. This value can be null.screenTip - The screen tip displayed when the mouse pointer pauses over the hyperlink. This value can be null.textToDisplay - The text to be displayed for the hyperlink. Pass an empty string to use the default display text.IHyperlink object.When this collection belongs to a worksheet, this method deletes all hyperlinks in the worksheet. When it belongs to a range, this method deletes the hyperlinks in that range.
IRange range = worksheet.getRange("A1:A2");
range.getHyperlinks().add(worksheet.getRange("A1"), "https://www.example.com", null, "Open example", "Example");
range.getHyperlinks().delete();