File hyperlinks


How do I add a hyperlink to an external file in the spreadsheet?


Please try the following code:

worksheet.Hyperlinks.Add(“A5”, 1, 1, “c:\book1.xls”);


Is it possible to have the hyperlink show a different value then the actual link?

For example, I want to link to file ‘foo.txt’ but the text in the cell is ‘bar’?


Please try the following sample code:

Excel excel = new Excel();
Worksheet worksheet = excel.Worksheets[0];
worksheet.Hyperlinks.Add(“A5”, 1, 1, “c:\foo.txt”);
Cell cell = worksheet.Cells[“A5”];
cell.Style.Font.Color = Color.Blue;
cell.Style.Font.Underline = FontUnderlineType.Single;


Thank you! That looks to be just what I was looking for. Thanks again.


Hello Laurence, is it possible to add support for the ScreenTip… or Tooltip for the Hyperlink ? We do not want customers to see the hyperlink when they hover over the actual link. This is the tooltip that you set when you go into Excel and choose to Edit the Hyperlink. It looks like version Aspose.Excel does not support it. It would be nice to say w.Hyperlinks(n).ToolTip = “Some Tooltip”.



Hi Marty,

I will add this feature to Aspose.Excel in about one week. Thanks for your suggestion.


Thanks! No rush… but we will use that feature!

As always, thanks for the hard work!


Please try this attached fix. This screentip property is supported.


Thanks Laurence - looks good and it looks like that release is working fine! but I need to do more testing.
thanks again for your help!


Hi Laurence, after much testing the screen tip works but our excel reports have sporadic data from other worksheets scattered around and lost the fonts in some cells where we have mutiple fonts per cell. Some weird stuff so we backed out this release and went back to I’d be happy to test the next latest release when you think its stable.

thanks again



Hi Marty,

Could you please post a sample to show your problem? I will check it ASAP.


Hi Laurence, that might take a while, since its proprietary data. I'll try to think of things that might help.

- static cell data in cells from other sheets used in the designer template would end up being copied to places where I would do putvalue on another sheet. Cells with multiple fonts would lose a style like BOLD or a color.

I wish I had a test harness I could send but I can't.


Hi Marty,

Please try this fix.


Hello guys,

really great work, this Excel interface !

But we have a problem here with adding hyperlinks on UNC shares.

A file share here at our company must be accessed by the total name, like:

\rbgs3xxx\did12345678\someFolder\someMoreFolders …

But such links are not accessible in Aspose.Excel generated files :-((
You always have to open the link once in the Excel-Hyperlink-Editor and click on “OK” then it works. Or you go in the cell and hit “RETURN”, then it works.

Is there any chance of a quick fix for this ?

Thank you !



Hi Chris,

Please try this version.


I think I found a trace. See the attachment.

There is also added this ">file:// thing at the beginning :-(

Here some code extract:





Thank you Laurence, it works now Smile
That’s called support Big Smile

Only one question, as I have you “on the line”:

Is there a quick way to display such hyperlinks added with the “AddHyperlink” function blue and underlined as default ?
Or can this only be done by setting the style of the cell in the code ?

An happy Chris :slight_smile:


Hi Chris,

If the display text is same as the link text, the hyperlink will be blue and underlined as default.

Please try the attached fix. You don’t need to set the style even if the display text is not same as the link text.

Excel excel = new Excel();
Worksheet sheet = excel.Worksheets[0];
int index = sheet.Hyperlinks.Add(“B2”, 1, 1, @"\server\path\file.xls");
Hyperlink hlink = sheet.Hyperlinks[index];
hlink.TextToDisplay = “Link to file”;


Hello Laurence, still problems with is the release we use without problems. I still see cells copied from other sheets and cells with mutiple styles/colors and bold are not working.

I can send you a before (working) and after (corrupt) worksheet if you want but I may need to cut the data down in size.

please let me know
thanks for looking at this.