| sidebar_label | insertLink() |
|---|---|
| title | insertLink method |
| description | You can learn about the insertLink method in the documentation of the DHTMLX JavaScript Spreadsheet library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Spreadsheet. |
@short: inserts/removes a hyperlink in a cell
insertLink(
cell: string,
link? : {
text?: string,
href: string
}
): void;cell- (required) the id of a celllink- (optional) an object with configuration of a link:text- (optional) a text you want to display for a hyperlinkhref- (required) the URL of the page the hyperlink leads to
:::info
To remove a hyperlink but keep the text, call the method without the link parameter.
:::
const spreadsheet = new dhx.Spreadsheet("spreadsheet", {});
spreadsheet.parse(data);
// insert a link in "A2" cell
spreadsheet.insertLink("A2", {
text:"DHX Spreadsheet", href: "https://dhtmlx.com/docs/products/dhtmlxSpreadsheet/"
});
// remove a link from "A2" cell
spreadsheet.insertLink("A2");Change log: Added in v5.0
Related article: Work with Spreadsheet