Hyperlinks worked, then quit working...

Mar 13, 2015 at 8:28 PM
Using current version of NPOI under Win7 64-bit, VS2013.

My program worked great (under 4.5.1), I was able to add a hyperlink to a directory that brought up Windows Explorer in a newly-created directory. The DLLs I used were in a directory called 'dotnet2'.

Then I realized the target machines would not have .NET 4.5.1, probably only 2.0, so I created a new project, copied my source over, added the references to 'dotnet2' NPOI DLLs.

Now my cell has the hyperlink style, but there is no hyperlink to the directory, and the mouse pointer does not change. When debugging, everything seems to go correctly.

Here's a code snippet; does anything look incorrect?
ICell cmdLineCell = row.GetCell(4);
cmdLineCell.SetCellValue(fullPath);

string uriDir = Path.GetDirectoryName(fullPath);
Uri linkAddr = new Uri(uriDir);

try
{
    link.Address = (linkAddr.AbsoluteUri);
    cmdLineCell.Hyperlink = (link);
    cmdLineCell.CellStyle = (hlink_style);
}
catch (Exception)
{
    Console.WriteLine("******* ERROR CREATING HYPERLINK *********");
}
Mar 13, 2015 at 8:45 PM
showens wrote:
Here's a code snippet; does anything look incorrect?
ICell cmdLineCell = row.GetCell(4);
cmdLineCell.SetCellValue(fullPath);

string uriDir = Path.GetDirectoryName(fullPath);
Uri linkAddr = new Uri(uriDir);

try
{
    link.Address = (linkAddr.AbsoluteUri);
    cmdLineCell.Hyperlink = (link);
    cmdLineCell.CellStyle = (hlink_style);
}
catch (Exception)
{
    Console.WriteLine("******* ERROR CREATING HYPERLINK *********");
}
I found the issue. The 'link' object has to be created each time a new cell is hyperlinked. I added this and everything worked again.
XSSFHyperlink link = new XSSFHyperlink(HyperlinkType.File);
Marked as answer by showens on 3/13/2015 at 12:45 PM