I get this exception while performing load HTML to Workbook.
Pseudocode below -
byte[] byteArray = Encoding.UTF8.GetBytes(html);
using (MemoryStream stream = newMemoryStream(byteArray))
{
returnnewWorkbook(stream);
}
Normally these code working fine and we got excellent excel file. but sometime when we do some large and complicate HTML . we got the exception like this
Cells in range K5:L5 cannot be merged because cells in range K4:L5 have already been merged.
we think you can reproduce this problem using attach file.
I am not sure is there a merge problem inside the HTML . but even it is a problem .
I still need a way to bypass those error and let user get an Excel file (we don't need perfect Excel)
right now , we can only show these error message to our client , but we don't know how to explain to them that their HTML have problem to convert to EXCEL.
Could you please advice whether we have any workaround?
Thanks for your posting and using Aspose.Cells for .NET.
We were able to replicate this exception with your given html file. We have logged this issue in our database for investigation. We will look into it and resolve this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.
We reproduced the issue as you mentioned by loading your template HTML file. We found an exception “com.aspose.cells.CellsException: Cells in range A23:R23 cannot be merged because cells in range A23:A24 have already been merged” on reading the HTML.
e.g. Sample code:
Path path = Paths.get("f:\\files\\output.html");
byte[] byteArray = Files.readAllBytes(path);
InputStream inputStream = new ByteArrayInputStream(byteArray);
HtmlLoadOptions loadOptions = new HtmlLoadOptions(LoadFormat.HTML);
Workbook convertedDocument = new Workbook(inputStream, loadOptions);//exception
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSJAVA-45097
You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@ghostofisland
The file contains many tables with different column widths, but each sheet of an Excel file can only have one table, and the column widths must be uniform.
We can only do as much as possible as shown in Excel. But we need some time to study a better layout.
@ghostofisland
Please check23.2.1.zip (291.1 KB)
generenated by inner hot fix 23.2.1.
There are still some issues .
Could you share your source template words file?
“float:left” css applies to some images,so some images and tables are horizonally aligned in brower.
But we need more time to study how to make “float:left” css works in Excel files.