We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Hyperlinks in XLS not rendering as expected

Hi all,

I am using the documented method for creating HTML hyperlinks within a cell that point to an external web page. It seems to me this method was working fine at one point and then I started having problems, even though I did not change any code.

Here is the code I am using.

'Setting the font of the Link cell to Single Underline
ws0.Cells(intSumRow, 0).Style.Font.Underline = FontUnderlineType.Single

'Adding a hyperlink to Link cell
strWebPath = strRootIP & "/Common/View.aspx"
ws0.Hyperlinks.Add(intSumRow, 0, 1, 1, strWebPath)

The strWebPath variable is resolving correctly as (for example) www.site.com/Common/View.aspx .

However, when I get the XLS document the URL of the link has become:

C:\Documents and Settings\john\Local Settings\Temporary Internet Files\Content.IE5\6SIO7MEY\www.site.com\Common\View.aspx

What on earth is going on here? I didn't ask Aspose Cells to prefix the URL with the location of my temporary internet files. Has anyone seen this problem? What is the fix?

Thanks to all...

Hi,

Which version of Aspose.Cells for .NET you are using?

I tested with the attached version (latest fix: 4.5.0.7) and it works fine using your code.

Kindly try it.

Thank you.

Hi,

I tried the new version and am still getting the same thing. Here is what I have noticed. If ,when prompted to "Save" or Open" the XLS file from the web server if I choose "Open" then the Hyperlink gets prefixed with the Temporary Internet Files folder.

If I choose "Save" to a Folder and THEN open the file, the Hyperlink gets prefixed with the folder location in which it was saved.

Not that in both examples I have sent you the correct URL is imbedded in the link but has been changed to File format. The URL should start with "64.252.190.214/Common/listview.aspx?listid=" but that is just buried in the FILE designation.

Please look at samples and help. It is so strange that the URL is prefixed differently depending on whether it is "Saved" or "Opened" first upon download.

Hi again,

I think that I have found what causes the problem. When I set a Web URL to a simple IP address like 64.290.130.34 then Aspose Cells for some reason interprets that to mean I am making a FILE reference and treats the Hyperlink accordingly. However, if I preface the IP address of the URL with http:// such as in `http://64.290.130.34`, then everything goes as expected.

So, even though a Web Browser will navigate properly with just an IP address, Aspose Cells apparently needs to see the http:// in order to create a properly formed Internet URL, otherwise it creates a file reference.

OK then...just another question.

Please tell me how I can make a HyperLink on WorkSheet(0) point to another worksheet in the same workbook such as WorkSheet(1).

Thanks

Hi,

Thanks for the template files.

Could you try to add "http://" as a prefix to your original url as follows :


Workbook workbook = new Workbook();
Worksheet ws0 = workbook.Worksheets[0];
//Setting the font of the Link cell to Single Underline
ws0.Cells[0, 0].Style.Font.Underline = FontUnderlineType.Single;
//Adding a hyperlink to Link cell
ws0.Hyperlinks.Add(0, 0, 1, 1, "`http://64.252.190.214/Common/ListView.aspx?type=list&listid=79508&brk=`");
workbook.Save(@"d:\test\mybooklinks.xls");

Thank you.

Hi,

Nice to know that you have done it already :)

Please check the following doc how you can add interanl and external hyperlinks:

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/adding-hyperlinks-to-link-data.html

Thank you.

I have just discovered that the in Excel 2007 the hyperlinks are changed such that the root part of the URL such as `http://powercard.statware.org` is replaced by c:\. The exact same XLS opened in Excel 2003 shows the link properly.

I have gone into the Trust Center for Excel 2007 and checked "Enable All Data Connections" under "External Content" and still the problem persists.

We are talking about opening the exact same XLS file in 2 different versions of Excel. What can I do to fix this? What do I tell my customers that use Excel 2007?

By the way, my Excel 2007 is installed on a Vista machine. I'm not sure if that is the culprit. Excel 2003 is installed on an XP machine.

Thank you

Hi,

Well, I don't find the problem you have mentioned. I opened the same xls file (having hyperlinks) generated by Aspose.Cells for .NET into MS Excel 2003 and 2007 with no issue at all. I have installed both versions of Excel on the same win xp machine.

By the way, could you try to manually create hyperlinks in MS Excel 2003, save the file using Save menu option, now open the same file into MS Excel 2007 and check if the hyperlinks changed as you mentioned above or not.

Thank you.