Free Support Forum - aspose.com

Deleting hyperlinks from a range in an Excel worksheet


#1

Hi,

Can you please advise on how to delete hyperlinks from a specific range (and not the entire worksheet) in an Excel worksheet ? Since the getHyperlinks() method is visible only at the worksheet level, iterating through cells in the range and clearing the hyperlinks cell-by-cell does not seem to be an option.

The VBA code for reference is as follows,

> If range.Hyperlinks.Count > 0 Then
>         While range.Hyperlinks.Count > 0
>             range.Hyperlinks(1).Delete
>         Wend
> End If

Thanks


#2

@jinesh.parikhmca1983,

Well, the hyperlinks are maintained as a separate entity (this is same as MS Excel) and can be accessed/manipulated using the HyperlinkCollection and Hyperlink classes. This is because a hyperlink can span over multiple cells as well as specified for a merged cell. Moreover, the order of the hyperlinks in the HyperlinkCollection class is not associated with the cell reference (where hyperlink reside) but the order in which the hyperlinks have been added manually or via code.

I am afraid, you got to iterate through range cells clear the hyperlinks as there is no better way to cope with it.


#3

@jinesh.parikhmca1983,

We have added Range.Hyperlinks property in the API. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.


#4

@jinesh.parikhmca1983,

Please try our latest version/fix: Aspose.Cells for .NET v19.1.7:

Aspose.Cells19.1.7 For .Net2_AuthenticodeSigned.Zip (4.7 MB)
Aspose.Cells19.1.7 For .Net4.0.Zip (4.8 MB)

Your issue should be fixed in it.

Let us know your feedback.


#5

The issues you have found earlier (filed as CELLSNET-46582) have been fixed in Aspose.Cells for .NET v19.2. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi