Hi,
Sorry for the confusion.
Please use Workbook.HasExternalLinks() method to check whether a workbook has some external references. Also, you may use Cell.ContainsExternalLink boolean attribute to check if a cell has external link reference in the formula. See the sample code below:
Workbook workbook = new Workbook();
workbook.Open("e:\\test\\ExtBook2.xlsx");
bool checklinks = workbook.HasExernalLinks();
MessageBox.Show("External Links: " + checklinks.ToString());
//Get the first worksheet.
Worksheet worksheet = workbook.Worksheets[0];
// workbook.CalculateFormula();
int cnt = 0;
for (int i = 0; i <= worksheet.Cells.MaxDataRow; i++)
{
for (int j = 0; j <= worksheet.Cells.MaxDataColumn; j++)
{
if (worksheet.Cells[i,j].ContainsExternalLink)
{
cnt++;
MessageBox.Show(worksheet.Cells[i,j].Name);
MessageBox.Show(worksheet.Cells[i,j].Formula);
MessageBox.Show(worksheet.Cells[i, j].StringValue);
}
}
}
MessageBox.Show("total external links in sheet1: " + cnt);
Thank you.
Amjad Sahi
Support Developer,
Aspose Sialkot Team
Contact Us