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.

C#

            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--)
                {
                    range.Hyperlinks.RemoveAt(i-1);
                }
            workbook.Version = ExcelVersion.Excel2010;

VB

            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
                Next
 
            workbook.Version = ExcelVersion.Excel2010
 

The sample illustrating this behavior is available here.

 

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