Custom CellType Icon with Hyperlink

Posted by: atul.vekariya on 15 January 2021, 12:18 am EST

  • Posted 15 January 2021, 12:18 am EST

    I created a custom CellTypes for Icon. I wanted to add a hyperlink as well.


    sheet.getCell(0, 0).text("Circle text.").cellType(new IconCellType(document.getElementById("icon-lock")));


    Need to add Hyperlink in "Circle text." with Icon.
  • Marked as Answer

    Replied 17 January 2021, 9:02 pm EST

    Hi Atul,

    You may inherit the HyperlinkCellType for the required functionality. Please refer to the following code snippet and let us know if you face any issues.
    export function IconCellType(img) {
    this.typeName = "IconCellType";
    this.img = img;
    }
    IconCellType.prototype = new GC.Spread.Sheets.CellTypes.HyperLink();
    var cellType = new IconCellType(document.getElementById("icon-lock"));
    cellType.linkColor("blue");
    cellType.visitedLinkColor("#FF2235");
    cellType.text("This is Circle text.");
    cellType.linkToolTip("Company Web Site");

    sheet
    .getCell(0, 0)
    .text("This is Circle text.")
    .value("http://www.google.com/")
    .cellType(cellType);
    sheet.getCell(1, 0).cellType(cellType).value("http://spread.grapecity.com/");


    Regards
    Avinash
  • Replied 17 January 2021, 9:48 pm EST

    Perfect !!

    Thanks for the quick reply.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels