Issue when converting an Excel worksheet embedding shared file URLs into HTML format

I tried to convert a .xls file whose some cells contain links like :

file://///host/some/directory/a_file.xls

Those links works in Excel. However, when I try to convert the workbook into an html file, I end up with urls like:

<a href="\\host\some\some\a_file.xls">

These anchors doesn’t work with IE (at least 11) or Firefox. I have to reformat them using this code block:

For Each hl As Hyperlink In eksel.Worksheets.Item(0).Hyperlinks
    Console.WriteLine(hl.Address)
    If Regex.IsMatch(hl.Address, "\\\\[a-z0-9_-]+",
                     System.Text.RegularExpressions.RegexOptions.IgnoreCase) Then
        hl.Address = "file://///" + hl.Address.Substring(2)
    End If
Next

(It replaces the double backslash prefix \\ with file://///.)

The issue doesn’t occur with documents (Aspose.Words) and presentations (Aspose.Slides). I use Aspose.Cells 18.9.

Is this a normal behavior?

@monir.aittahar,

Thanks for providing us details.

Please try our latest version/fix: Aspose.Cells for .NET v19.2.x.

If you still find the issue, kindly do provide your input Excel file and output HTML file (you may zip the files prior attaching here), we will check it soon.

Hi @Amjad_Sahi,

Currently we cannot use the last version, since we would need to renew our license. Anyway, do you want a (zipped) Excel file as a test sample?

Regards.

@monir.aittahar,

Although we cannot evaluate your issue using older version of the product but you may attach your zipped archive to test your issue. Moreover, we cannot fix any issue in older versions, all the fixes are based on latest APIs set. So, if this was a bug in older version, we cannot fix it. But let us evaluate your issue with your samples first.

@Amjad_Sahi,

Thanks for your answer. You’ll find attached (25.2 KB) in this post:

cells-shared_file_links_conversion.zip
├── test.xlsx
├── test-fixed.html
├── test-fixed_files
├── test-unfixed.html
└── test-unfixed_files
  • test.xlsx is the excel file used for the test
  • test-unfixed.html and test-unfixed_files are the HTML conversion directly output by the Cells.Workbook.Save() method
  • test-fixed.html and test-fixed_files are the HTML conversion set after appliying the workaround quoted in my first message and the Cells.Workbook.Save() call

The unfixed link got looks like:

<a href="../\\SOME_HOST\Some_dir\some_file.txt" target="_parent">
  <span [...]>\\SOME_HOST\Some_dir\some_file.txt</span>
</a>

The fixed one looks like:

<a href="file://///SOME_HOST\Some_dir\some_file.txt" target="_parent">
   <span [...]>\\SOME_HOST\Some_dir\some_file.txt</span>
</a>

(By the way I accidentally uploaded more than one the attached file, sorry. Is there a way to clean this?)

@monir.aittahar,

I have tried to convert the sample “test.xlsx” to HTML using Excel 365 and observed the following:

Your desired output:
file://///SOME_HOST\Some_dir\some_file.txt
Excel generates:
file://SOME_HOST/Some_dir/some_file.txt
Aspose generates:
../\\SOME_HOST\Some_dir\some_file.txt

It is noted that your expected output is different than the output created by Excel. As Aspose.Cells can mimic the output generated by Excel as per policy, therefore could you please confirm if output generated by Excel is acceptable to you or not. If your desired output is exactly the same as that of Excel, we will log an issue and investigate it further. Please provide your feedback so that we may proceed to sort out this issue.

@ahsaniqbalsidiqui,

Thanks for your answer.

What Excel generates is OK:

file://SOME_HOST/Some_dir/some_file.txt

Those kind of file URLs works in IE 11 Enterprise Mode (and IE 11 anyway).

Regards.

@monir.aittahar,

Thank you for the feedback. We are clear about the requirement now but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46623 - Issues in embedded shared file URLs while converting Excel file to HTML

@monir.aittahar,

This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-46623”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@monir.aittahar,

Please try our latest version/fix: Aspose.Cells for .NET v19.2.5 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells19.2.5 For .Net2_AuthenticodeSigned.Zip (4.8 MB)
Aspose.Cells19.2.5 For .Net4.0.Zip (4.8 MB)

@Amjad_Sahi,

Thanks you very much. Actually our license ended October 9th. I suppose we need to renew it to be able to check this version. If so, we let you know if this fixed our issue.

Regards.

@monir.aittahar,

Yes, you are right as your license has expired on October 9th, therefore all the product versions which are released before this date can be used with this license. If you want to check the latest version of the product, you may renew the license.

@ahsaniqbalsidiqui, we’ll discussing this point with our client, in case he wants to renew the license, I’ll be able to let you a feedback.

Regards.

@monir.aittahar,

Sure we will be waiting for your response. Please note that this hotfix can be used without license as well however the evaluation version limitations will be there as mentioned here.

The issues you have found earlier (filed as CELLSNET-46623) have been fixed in Aspose.Cells for .NET v19.3. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi

Deall all,

Thank you very much, I’ve just tested the fix and it’s working.

Best regards,
Monir

@monir.aittahar,
You are welcome.