Controlling generation of "id" attributes when saving to HTML

Hi,

Using Aspose Cells for Java, version 19.9.

It seems that in recent versions, Aspose Cells has slightly changed the format of the generated HTML. Now, for each row, an id attribute is added:

<tr height='20' style='mso-height-source:userset;height:15pt' id='r0'>
 <td height='20' width='64' style='height:15pt;width:48pt;'>foo</td>
</tr>
<tr height='20' style='mso-height-source:userset;height:15pt' id='r1'>
 <td height='20' style='text-align:right;height:15pt;'>1</td>
</tr>

It seems that this is an Aspose-specific attribute, as the output from Excel 365 does not include such attributes. In our application we are loading and showing multiple exported worksheets in a single web page. Because of the unconditional, sequential id generation for <tr> elements, we run into id conflicts.

In a way, this issue is very similar to the one described in Problem with Excel to Html Conversion, for which you introduced the cssStylePrefix setting.

If the intent of adding the id attribute was to encode the information regarding “which row is this?” into the generated HTML, HTML data attributes seem a better option. Unlike the id attribute, data attribute values simply contain data, and do not require uniqueness across the document.

It would be nice if we could configure whether row id attributes are generated in HTML. Another option would be a add a prefix property, similar to cssStylePrefix. But I think switching to a data attribute as described above would be the best option overall.

Kind regards,
Taras

id.zip (7.7 KB)

@TarasTielkes,
We have understood your requirement but we need to look into it more. We have logged the issue in our database for investigation and for a fix(if possible). Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-43024 – Controlling generation of "id" attributes when saving to HTML

A post was split to a new topic: Queries about id attribute on cells (`’ elements)