File hyperlinks


#1

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


#2

Please try the following code:

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


#3

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’?


#4

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.PutValue(“bar”);
cell.Style.Font.Color = Color.Blue;
cell.Style.Font.Underline = FontUnderlineType.Single;
excel.Save(“c:\hlink.xls”);


#5

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


#6

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 3.2.0.3 does not support it. It would be nice to say w.Hyperlinks(n).ToolTip = “Some Tooltip”.

thanks
Marty


#7

Hi Marty,

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


#8

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

As always, thanks for the hard work!
Marty


#9

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


#10

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!
Marty


#11

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 3.2.0.3. I’d be happy to test the next latest release when you think its stable.



thanks again

Marty


#12

Hi Marty,

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


#13

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.
Marty


#14

Hi Marty,

Please try this fix.


#15

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 !

Chris


#16

Hi Chris,

Please try this version.


#17

I think I found a trace. See the attachment.

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

Here some code extract:

ws.Hyperlinks.Add(5+i,5,1,1,"\\rbgs353x\did01204\testFolder\TestFile.xls);


Chris


#18

GREAT !

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:


#19

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”;
excel.Save(@“d:\book1.xls”);


#20

Hello Laurence, still problems with 3.4.2.2. 3.2.0.3 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.
Marty