: While loading an HTML object and saving it as Excel, Aspose does not include the caption tag/element for the table

Hi Team,
We have found another issue with Aspose cell.
When downloading the Html page into the worksheet the header text( inside the Caption tag) is disappeared. How ever, when downloading the same Html page into EXCEL file directly, the header text is showing correctly.

Here is the sample code .
Sample driver code :
byte[] data = Files.readAllBytes(Paths.get(“tmp.html”));
HtmlLoadOptions opts = new HtmlLoadOptions(LoadFormat.HTML);
opts.setAutoFitColsAndRows(true);
opts.setConvertNumericData(false);
opts.setSupportDivTag(true);
Workbook downloadedWorkbook = new Workbook(new ByteArrayInputStream(data), opts);
downloadedWorkbook.save(“html_read.xls”, FileFormatType.EXCEL_97_TO_2003);

Same Html page (temp.html):

.number { mso-number-format:’@’; }
Sample caption
Column1 Column2 Column3
100 200 300
400 500 600

Here is the htmlString for the tmp.html( since i could not attach the file. I am pasting it as html string)

private String html(){
return “\n” +
“.number { mso-number-format:’\@’; }\n” +
“\n” +

\n” +
“\t<table cellspacing=“0” rules=“all” style=“color:Black;background-color:White;border-color:Black;border-width:2px;border-style:solid;font-size:9pt;border-collapse:collapse;”>\n” +
“\t\t<caption align=“Left”>\n” +
“\t\t\tSample caption
\n” +
“\t\t\n” +
“\t\t<tr style=“color:White;background-color:Navy;”>\n” +
“\t\t\t<th align=“left” scope=“col”>Column1<th align=“left” scope=“col”>Column2<th align=“left” scope=“col”>Column3\n” +
“\t\t\n” +
“\t\t\n” +
“\t\t\t<td class=“number”>100<td class=“number”>200<td class=“number”>300\n” +
“\t\t\n” +
“\t\t\n” +
“\t\t\t<td class=“number”>400<td class=“number”>500<td class=“number”>600\n” +
“\t\t\n” +
“\t\t\n” +
”;
}

@cgkrish
We found your mentioned issue.I have logged a ticket with an id “CELLSJAVA-44496” for your issue. We will look into it soon.

Thanks very much, please let us know when it can be fixed.
Thanks again for your help
with regards
Puva

@cgkrish,

Please spare us little time to evaluate your issue in details first. And, sure, we will keep you posted with updates on the resolution.

Thanks very much . Have a nice weekend.

Hi
Could you please let us know when it can be fixed?
thanks
puva

@cgkrish,

We are pleased to inform you that the issue (logged earlier as “CELLSJAVA-44496”) has been resolved now. The fix will be included in the next release (Aspose.Cells for Java v22.4) which is scheduled to be published before the end of this week or in the next week early. You will also be notified when the next version is released.

Hi [Amjad_Sahi],
Thanks very much for the fixing issue.

with regards
Puva

@cgkrish,

You are welcome.

The issues you have found earlier (filed as CELLSJAVA-44496) have been fixed in this update. This message was posted using Bugs notification tool by Peyton.Xu

Hi,
thanks for fixing it. We have updated latest provided ( 22.4) Aspose library and found that the fix does not work correctly.
While loading an HTML object and saving it as Excel, Aspose does not include the caption tag/element for the table.

Sample driver code :
byte[] data = Files.readAllBytes(Paths.get(“tmp.html”));
HtmlLoadOptions opts = new HtmlLoadOptions(LoadFormat.HTML);
opts.setAutoFitColsAndRows(true);
opts.setConvertNumericData(false);
opts.setSupportDivTag(true);
Workbook downloadedWorkbook = new Workbook(new ByteArrayInputStream(data), opts);
downloadedWorkbook.save(“html_read.xls”, FileFormatType.EXCEL_97_TO_2003);

We have used the same html as given above.
please check and advise.
Thanks
puva

@aspose.notifier,

I tested using a sample HTML file but could not reproduce the issue with latest version. Could you please zip and attach “tmp.html” file, we will test your issue and try to reproduce the issue with your provided “tmp.html” file.

Hi,
sorry for the delay.

Here is the html code

.number { mso-number-format:'\@'; }
Sample caption 1
Sample caption 2
Sample caption 3
Sample caption 4
Column1 Column2 Column3
100 200 300
400 500 600

@cgkrish,

Thanks for HTML code.

Please notice, I am able to reproduce the issue as you mentioned by using your HTML source. I found multi-lines captions are lost except the first line in HTML to XLS conversion. I have logged a ticket with an id “CELLSJAVA-44568” for your issue. We will look into it soon.

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

@cgkrish

In the coming fix/release, all the four caption lines will be output: output_four_lines_captions.zip (1.2 KB)

However, the bold style of 3rd and 4th caption lines is lost, and it can’t be fixed currently. Please set <b></b> for each caption line in html as a workaround with the coming release. See my modified source html file: bold_for_each_caption_line.zip (537 Bytes)

Please let us know your feedback.

Thanks very much for fixing it. let us know once it is completed.

@cgkrish,

You are welcome. And, sure, we will keep you posted with updates on latest (upcoming) version.

Hi,
Thanks very much for working hard to fixing it.
Could you please provide the ETA for the release ( date for the release) so that we can plan according to this.
thanks
Puva

@cgkrish

The fix will be included in the next release (Aspose.Cells for Java v22.5) which is scheduled in the second week of May 2022. You will also be notified when the next version is released.