How to get appropriate cell coordinate after converting to HTML?

I have converted the Excel File to HTML, how can I get the cell coordinate from the td_tag of the HTML file which corresponds to the Excel FIle’s cell coordinate.

Basically the user performs some actions on the converted HTML, so I need the coordinates to save the data back to the original Excel FIle.

Thanks in advance!

@dharanikumar7998,

I am afraid, we do not support this feature but we can look into it. Could you please provide more details about your requirements. Please provide sample source Excel file and your expected resultant HTML file, etc. The expected output file should have td elements with special text/data. You will get special td elements according to specific text or set the attribute “id” of td element to get the special td.

PS. please zip the files prior attaching here.

Will send you in a couple of days, appreciate your help!

@dharanikumar7998,

Sure, please take your time to compile the samples.

Hi, sorry for the delay. I have attached a sample Excel and HTML.
So basically if you see, There are 2 columns, and four rows in the Excel File. I can get what row a data belongs to in the HTML from the tr tag which had id attribute (r0, r1, …) . You can see this in the row image I attached, but I can’t get the column value of the data for which the user filled some answer in Answer column. There is no id for td tags.

I user cellIndex property of HTML to get the index of the td tag and used it as column value, but this failed me when there were merged cells in the Excel.

Hope I made this clear! If not please do tell me.

P.S we do have license.
forum.zip (106.8 KB)

@dharanikumar7998,
We have observed the contents in HTML as shared by you however if we convert the same Excel file to HMTL using MS Excel, it also does not have this information. As Aspose.Cells mimics the behavior of MS Excel, therefore it is not possible to generate different output than MS Excel.

Could you please explain how can we get this information by converting this Excel file to HTML by any other third party tool? It will help us to observe the output HTML file and share our feedback.

I don’t have any way / third party tool to get the column index, that’s why I posted it in the forum :sweat_smile: hoping to get a solution here. In a nutshell, I want to get the Excel Coordinate from the HTML. I looked for a option in HTMLSaveOptions but no luck there.

You guys gave me some nice hacks for my previous issues, if you have any it will be nice.

@dharanikumar7998,

We can log a ticket for it. Please also provide your expected resultant HTML file. The expected output file should have td elements with special text/data or other elements, so, you will get special td elements according to specific text or set the attribute “id” of td element to get the special td for your needs. This will help us to check the feasibility if we can achieve it.

It will be helpful if you could set an attribute as “excel_coordinate” or some other name to the td tags. This attribute will have the excel coordinate value like “D7, D24” etc. And if possible assign this attribute with “D7 - D10” or something like this for merged cells.

Will be really helpful if you could provide me a solution for this!

@dharanikumar7998,

Please note, generally, Aspose.Cells follows MS Excel standards and specifications when rendering to HTML file format. The HTML generated by Aspose.Cells is a kind of MS Excel oriented HTML in most cases, it would be same as you manually save a workbook as “Web page” via MS Excel. Anyways, we need to evaluate regarding your suggestions. We have logged a ticket with an id “CELLSNET-47922” for your requirements. We will look into it soon.

Once we have an update on it, we will let you know here.

@dharanikumar7998,
Please try the latest fix 21.3.4.
Aspose.Cells21.3.4 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells21.3.4 For .Net4.0.Zip (5.5 MB)
Aspose.Cells21.3.4 For .NetStandard20.Zip (5.5 MB)

There are some tips for you:
1.Adds HtmlSaveOptions.ExportCellCoordinate property which indicates whether exporting excel coordinate of nonblank cells when saving file to html. The default value is false.
If you want to import the output html to excel, please keep the default value.

2.The sample code in .NET as follows:
Workbook wb = new Workbook(filePath + “Book1.xlsx”);
HtmlSaveOptions options = new HtmlSaveOptions();
options.ExportCellCoordinate = true;
wb.Save(filePath + “out.html”, options);

Let us know your feedback.

Thanks a lot, just give me sometime, I’ll let you know soon.

@dharanikumar7998,

Sure, please take your time to evaluate the new fix for your requirement. Hopefully, it will suit your needs. Please notice “excelCoordinate” attribute in the HTML source for your reference.

The issues you have found earlier (filed as CELLSNET-47922) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao