This project has moved and is read-only. For the latest updates, please go here.

Read hyperlinks values

Aug 21, 2012 at 2:49 PM

We need to read hyperlinks values from Excel file.

Sample code :

using (ExcelPackage pack = new ExcelPackage(fileInfo))
{
    ExcelWorksheet ws = pack.Workbook.Worksheets["X1"];
    for (int row = 2; row <= 10; row++)
    {
        ExcelRange cell = ws.Cells[row, 2];
        if (cell.Hyperlink != null)
        {
            string link = cell.Hyperlink.OriginalString;
        }
    }
}

If all rows have the same value / hyperlink, then from the 3rd row, the hyperlink is null !
If the hyperlinks have different values, then it's ok !

Sample file : http://91.121.165.66/public/download/test1.zip