Different number of link sources Aspose.Cells vs. Excel application

Hi Aspose team,

sometimes when we use Aspose components to read link sources in Excel files we are getting different number of them compared to what is visible directly in Excel (Data => Connections).

If you run attached project you will see that there are 13 link sources reported by Aspose (btw. same number is visible also if you go to xl\externalconnections_rels) but when I open document in Excel I see only 8 connections.

I understand that you show what is really stored in Excel files but is there any option to recognize with Aspose.Cells what is visible in Excel in Data => Connections and not to show all Link Sources (8 vs. 13 in my example)?

Thanks in advance,
Oliver

MultipleLinkSources.zip (350.5 KB)

@dr.doc,
We have observed this issue and logged in our database for further investigation. We will notify you once any update is ready to share.

This issue is logged as:
CELLSNET-47566-Different number of link sources Aspose.Cells vs. Excel application

@dr.doc,
There are 13 external links in file, but there are 5 invisible links.

Workbook workbook = new Workbook(dir + "LinkSources.xlsx");
int count = 0;
for (int i = 0; i < workbook.Worksheets.ExternalLinks.Count; i++) {
Console.WriteLine("Link source: " + (i + 1).ToString());
Console.WriteLine(workbook.Worksheets.ExternalLinks[i].DataSource);
Console.WriteLine(workbook.Worksheets.ExternalLinks[i].OriginalDataSource);
Console.WriteLine(workbook.Worksheets.ExternalLinks[i].IsVisible);
if(workbook.Worksheets.ExternalLinks[i].IsVisible) {
count++;
}
Console.WriteLine("============================================");
//Console.WriteLine("ToString:" + workbook.Worksheets.ExternalLinks[i].ToString());
}
//Console.WriteLine("-----");
//Console.WriteLine("");
Console.WriteLine("============================================");
Console.WriteLine("Total number of link source: " + (workbook.Worksheets.ExternalLinks.Count).ToString());
Console.WriteLine("Total number of visible link source: " + count.ToString());
Console.WriteLine("============================================"); 

Thanks for quick update.
At the end, that was my question - how can I see what is visible and what not.

Thanks for providing resolution :slight_smile:

@dr.doc,

Good to know that your issue is sorted out by the suggested code segment. In the event to further queries or issue, feel free to write us back, we will be happy to assist you soon.

Hi Amjad,

some additional questions:

  • What exactly is IsVisible? How is this defined as when I check some of my Excel files I see that IsVisible is false (I assume that under Data => Edit Connections I will not see this link source) but they are with IsReffered=True.

Now my understanding:

  • IsVisible - this flag tells me if link source is visible under Edit Connections
  • IsReffered - shows me if link source is used somewhere in Excel document

Is it possible that link source is not visible in Excel (IsVisible=False) but is referenced somewhere in document (IsReffered=True)?

Do you know how can I hide link sources from Excel?

Thanks,
Oliver

@dr.doc,

You understanding seems correct.

We will check and provide complete details on your queries soon.

@dr.doc,
We check ExternalLink.IsVisible and ExternalLink.IsReffered by whether this external link is Referred by formulas in the file.
If an external link is referred in some defined names, but these defined names are never referred in other formulas, ExternalLink.IsReffered is true and ExternalLink.IsVisible is false.