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

Free Support Forum - aspose.com

Hyperlinks are not working on converting Excel to HTML

Hello,


I am using Aspose.Cells v8.6.2.4
In the attached Excel file, I am taking the HTML output of table - Table1. Table cells contain some hyperlinks which are not working on converting the table to HTML.

I am using the following sample code to take HTML of Table1 in the attached excel sheet :

String worksheetName = “Sheet1”;
String tableName = “Table1”;
Workbook workbook = new Workbook(“D:\test.xlsx”);
Worksheet worksheet = workbook.getWorksheets().get(worksheetName);

ListObject table = worksheet.getListObjects().get(tableName);
Worksheet newWorksheet = table.getDataRange().getWorksheet();

Range sourceRange = table.getDataRange();
if (table.getShowHeaderRow())
{
//Include table’s header row
int fcol = sourceRange.getFirstColumn();
int frow = sourceRange.getFirstRow() - 1;

// including the first header row.
int rowCount = sourceRange.getRowCount() + 1;
// including the first header row.
int colCount = sourceRange.getColumnCount();

sourceRange = newWorksheet.getCells().createRange(frow, fcol, rowCount, colCount);
}

Workbook newWorkbook = new Workbook(FileFormatType.XLSX);
WorksheetCollection targetWsc = newWorkbook.getWorksheets();
Worksheet targetWs = (Worksheet)targetWsc.get(0);
Range targetRange = targetWs.getCells().createRange(0, 0, sourceRange.getRowCount(), sourceRange.getColumnCount());
PasteOptions options = new PasteOptions();
//Copy column widths
options.setPasteType(PasteType.COLUMN_WIDTHS);
targetRange.copy(sourceRange, options);

// Copy row heights
int rowCount = sourceRange.getRowCount();
int firstRow = sourceRange.getFirstRow();

for (int i = 0; i < rowCount; i++) {
double rowHeight = sourceRange.getWorksheet().getCells().getRowHeight(firstRow++);
targetWs.getCells().setRowHeight(i, rowHeight);
}
//Copy everything else
options.setPasteType(PasteType.ALL);
targetRange.copy(sourceRange, options);

HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions(SaveFormat.HTML);
htmlSaveOptions.setParseHtmlTagInCell(true);

newWorkbook.save(“D:\test.html”, htmlSaveOptions);

I have attached the excel sheet and Html-output as a text-file.

Can you please analyze this issue.

Thanks,
Neha

Hi Neha,


Thank you for sharing the sample & code.

Please note, if you convert the same spreadsheet to HTML via Excel application, you will notice that the Excel generates the hyperlink code with fragment identifier as follow (Table) whereas in case of Aspose.Cells APIs, the generated hyperlink code looks as follow (Table ). When you click on the hyperlink on Excel generated HTML, nothing happens because Excel has not generated the counter part for the fragment identifier, however, in case of Aspose.Cells generated HTML, clicking on the hyperlink results in “Resource not found” error because the browser tends to find the resource by name mytable. We have logged a ticket CELLSJAVA-41647 for the product team to review this case and make the behaviour identical to Excel. Please spare us little time to analyze this scenario and to get back with updates in this regard.

Hi,

Thanks for using Aspose.Cells.

This is to inform you that we have fixed your issue CELLSJAVA-41647 now. We will soon provide the fix after performing QA and including other enhancements and fixes.

Hi,

Thanks for using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for Java v8.6.3.2 and let us know your feedback.

Hello,


Thanks for your reply.

In the excel file I had provided earlier, the issue is resolved but unfortunately, this issue is still appearing for another excel file (please refer test.xlsx). Hyperlinks are not working in the excel file that I have attached. I have used Aspose.Cells v8.6.3.2 to take the HTML output.

Can you please analyse this issue.

Thanks,
Neha

Hi Neha,


Thank you for pointing out this problem.

We have evaluated the scenario and found your concerns to be true, that is; hyperlink pointing to a defined name becomes broken when spreadsheet is converted to HTML. In order to further investigate the matter, we have logged it as a separate incident in our bug tracking system, where the tracking Id is CELLSJAVA-41677. Please spare us little time for proper analysis. In the meanwhile, we will keep you posted with updates in this regard.

The issues you have found earlier (filed as CELLSJAVA-41647) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hello,


Is there any update on ticket - CELLSJAVA-41677 ?


Thanks,
Neha

Hi Neha,


I am afraid, the issue logged earlier as CELLSJAVA-41677 is currently unresolved. We have requested the concerned member of the product team to share the insight of the problem, and preferably an estimated time for the fix. As soon as we receive any updates in this regard, we will post here for your kind reference.

Hi,

Thanks for using Aspose.Cells.

It is to inform you that this issue CELLSJAVA-41677 should be fixed in about 4th March 2016.

Hi,

Thanks for using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for Java v8.7.1.2 and let us know your feedback.

Hello,


Thanks for your reply.

I am currently using Aspose.Cells v8.7.1.4. Unfortunately, the hyperlinks are still not working.

I have attached an excel file - “hyperlink_test.xlsx”. It has 2 sheets. There are 4 links on Sheet2 but only one of them - “namedrange1” is working. Although “namedrange2” points to Sheet1, but it is still not pointing to the exact location in Sheet1. The other 2 links are not working as well.

Following code is used to generate the output :

Workbook workbook = new Workbook(“hyperlink_test.xlsx”);
HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions(SaveFormat.HTML);
htmlSaveOptions.setParseHtmlTagInCell(true);
workbook.save(“D:\response_8.7.1.4.html”, htmlSaveOptions);

Can you please analyse this issue?

Thanks,
Neha

Hi Neha,


Thank you for sharing the samples.

I am able to observe the similar behaviour on my side as well therefore I have logged an investigative ticket with Id CELLSJAVA-41790 in our bug tracking system. Please spare us little time to look further into this matter, and get back with updates in this regard.

The issues you have found earlier (filed as CELLSJAVA-41677) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hello,

Is there any update on issue - CELLSJAVA-41790?

Our customers are waiting for this given issue to be resolved as soon as possible. Kindly provide the fix for this issue and also let us know the ETA of the fix so that we can update our customer accordingly.

Thanks,
Neha
Hi Neha,

I am afraid, the product team hasn't shared any updates regarding the ticket CELLSJAVA-41790. I have logged your comments to the aforementioned ticket and have requested the concerned member of the product team to share the ETA at earliest possible. As soon as we get any news in this regard, we will post here for your kind reference.

Thank you for your patience with us.

Hi again,


This is to update you that we are working on the ticket CELLSJAVA-41790, and we will hopefully provide the fix before 20th of September 2016.

Hi,


This is to update you that the ticket logged earlier as “CELLSJAVA-41790” has been resolved now. We will shortly share the fix/version after performing QA and incorporating other enhancements and fixes.

Thank you.
Hi,

Thanks for using Aspose.Cells.

We have fixed your issue CELLSJAVA-41790.

Please download and try the latest fix: Aspose.Cells for Java v9.0.4 and let us know your feedback.

The issues you have found earlier (filed as CELLSJAVA-41790) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.