Link breaking

Hi,

Could you please tell me if there is a way to break links using Aspose.Cells for .NET?
I see that there is an option to break all links via RemoveExternalLinks, but is there an option to remove/break only some links?

Kind regards,
Nina

@techna3,

You may check and manipulate those links by ExternalLinkCollection which you can get from WorksheetCollection.

1 Like

Hi @johnson.shi,

Thank you very much for your quick reply!
I see there is an option to “RemoveAt” and I assume that it does what I need.

Unfortunately, the version of Aspose.Cells that I’m using does not support this functionality, but I’m glad if this helps someone.

Cheers!

@techna3,

Yes, it will work for the purpose. You may upgrade to latest APIs set (if possible) to accomplish your desired task. See the sample code for your reference:
e.g.
Sample code:

var workbook = new Aspose.Cells.Workbook("e:\\test2\\Book1.xlsx");

var links = workbook.Worksheets.ExternalLinks;
var linksCount = links.Count;
      
for (int i = linksCount -1; i>=0; i--)
{
     if (links[i].IsReferred)
     {
         links.RemoveAt(i);
     }
}

Hope, this helps a bit.

1 Like

Hi @Amjad_Sahi,

Yes, both responses helped tremendously!

Thank you very much!

@techna3,

You are welcome.

Should you have further queries or comments, feel free to write us back.

1 Like