Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

New Post: Hyperlinks worked, then quit working...

$
0
0
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);

Viewing all articles
Browse latest Browse all 1621

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>