With Aspose.Cell for Java, could we load HTML to save it as Excel?
>>> We logged the feature as an id: CELLSNET-21710. We may look into it in future versions. Once we have any update about it, we will let you know.
Is this feature added in latest version?
Aspose.Cells does support to read/manipulate HTML file or save it to MS Excel file formats (e.g XLS, XLSX , XLSM, XLSB, etc.) But, generally, we support MS Excel oriented HTML files. Common HTML files are not completely supported. For example, you open your HTML file into MS Excel manually and save to XLS/XLSX. The resultant file would be the output file. The same thing can be done via Aspose.Cells APIs.
If you find any issue where MS Excel does support certain things and Aspose.Cells does not do well, please share your HTML file, we will check it soon.
The attached html.zip (135.6 KB)
.html file relies on .css for styling. However, with the below code, the formatting is lost converting html to excel. If I open the .html file manually in MS Excel, the formatting is retained. Could we achieve the same result with Aspose.Cells?
After an initial test, I am able to observe the issue as you mentioned by converting your template HTML to XLS file format. I found that CSS style/formatting is ignored in the output XLS file format. I have logged a ticket with an id “CELLSJAVA-42635” for your issue. We will look into it soon.
Once we have an update on it, we will let you know here.
I guess CSS style is not completely supported when rendering an HTML to XLS/XLSX but we have to evaluate your issue thoroughly. Please spare us little time to look into it.
Once we have any new information, we will share it with you.
This is to inform you that we have fixed your issue (logged earlier as “CELLSJAVA-42635”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.
@Amjad_Sahi Thanks for sharing the hotfix. I did a quick testing. The issue is not addressed completely. I see two issues.
The columns have constant width. The column width could have been calculated better (Open the html from my first thread in MS Excel to see what I mean).
The first column data (under “SW SRS Requirement”) is supposed to be bold.
We could not re-produce the issue where first column width takes up the entire screen width. The output XLS and XLSX file opens fine in Excel 365 and all the columns widths equal and visible on the screen without any scrolling. We have recorded this difference in our database and will work on it soon. We will write back here when any update is available.
Generally we publish official releases (.NET/Java) around the third week of every month. But it is not final all the time.The release is published when ready. Hopefully Aspose.Cells for Java v18.7 will be published in the third week of July 2018.
For the above html, the HTML to Excel conversion fails with the below error. The css property “windowtext” could be found in the .css file within the archive.
I can open this HTML successfully from MS Excel manually.
java.lang.NumberFormatException: For input string: “windowtext”
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1973)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:146)
at java.lang.Double.parseDouble(Double.java:552)
at com.aspose.cells.a.c.zp.a(Unknown Source)
at com.aspose.cells.zahp.b(Unknown Source)
We were able to observe the issue where this exception is raised while loading the HTML file into Workbook 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
CELLSJAVA-42675 - NumberFormatException raised while loading the Html file into Workbook