insertLink()
描述
在单元格中插入或移除超链接
用法
insertLink(
cell: string,
link? : {
text?: string,
href: string
}
): void;
参数
cell- (必填)单元格的 idlink- (可选)链接配置对象:text- (可选)要为超链接显示的文本href- (必填)超链接指向页面的 URL
信息
若要移除超链接但保留文本,请在调用该方法时不传入 link 参数。
示例
const spreadsheet = new dhx.Spreadsheet("spreadsheet", {});
spreadsheet.parse(data);
// 在 "A2" 单元格中插入链接
spreadsheet.insertLink("A2", {
text:"DHX Spreadsheet", href: "https://dhtmlx.com/docs/products/dhtmlxSpreadsheet/"
});
// 从 "A2" 单元格中移除链接
spreadsheet.insertLink("A2");
更新日志: 在 v5.0 中新增
相关文章: 使用 Spreadsheet