Aspose.Cells.GridWeb.Examples.CSharp.Worksheets.AddHyperlinks.AddTextHyperlinks C# (CSharp) Method

AddTextHyperlinks() private method

private AddTextHyperlinks ( ) : void
return void
        private void AddTextHyperlinks()
        {
            // ExStart:AddTextHyperlinks
            // Accessing the reference of the worksheet that is currently active
            GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex];

            // Adds a text hyperlink that goes to Aspose site and opens in new window
            int linkIndex = sheet.Hyperlinks.Add("B1", "http://www.aspose.com");
            GridHyperlink link1 = sheet.Hyperlinks[linkIndex];
            link1.Target = "_blank";

            // Setting text and tool tip of the hyperlink
            link1.TextToDisplay = "Aspose";
            link1.ScreenTip = "Open Aspose Web Site in new window";
             
            // Adding hyperlink to the worksheet to open in parent window
            linkIndex = sheet.Hyperlinks.Add("B2", "http://www.aspose.com/docs/display/cellsnet/Aspose.Cells.GridWeb");
            GridHyperlink link2 = sheet.Hyperlinks[linkIndex];
            link2.Target = "_parent";

            // Setting text and tool tip of the hyperlink
            link2.TextToDisplay = "Aspose.Grid Docs";
            link2.ScreenTip = "Open Aspose.Grid Docs in parent window";
            // ExEnd:AddTextHyperlinks
        }