Articles in this section
Category / Section

How to remove hyperlinks from hyperlink collection

1 min read

The code snippets for removing hyperlinks form its collection using XlsIO is shown below.


            IWorksheet sheet = workbook.Worksheets[0];
            IRange range = sheet.Range["A1:A3"];
            if (range.Hyperlinks.Count > 0)
                for (int i = range.Hyperlinks.Count; i >= 1; i--)
            workbook.Version = ExcelVersion.Excel2010;


            Dim sheet As IWorksheet = workbook.Worksheets(0)
            Dim range As IRange = sheet.Range("A1:A3")
            If range.Hyperlinks.Count > 0 Then
                Dim i As Integer
                For i = range.Hyperlinks.Count To 1 Step i - 1
                    range.Hyperlinks.RemoveAt(i - 1)
            End If
            workbook.Version = ExcelVersion.Excel2010

The sample illustrating this behavior is available here.


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment